- 积分
- 2280
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-9-11
- 最后登录
- 1970-1-1
|
发表于 2016-7-31 22:00:35
|
显示全部楼层
#-----------------------------------------------------
# Author: Yaqiang Wang
# Date: 2015-9-30
# Purpose: Get meteorological data along trajectory
# Note: Sample
#-----------------------------------------------------
# Set working directory
trajDir = 'D:/Temp/HYSPLIT'
meteoDir = 'D:/Temp/arl'
# Open trjactory data file
print 'Open trajectory data file ...'
trajfn = os.path.join(trajDir, 'traj_20150331')
print 'Trajectory file: ' + trajfn
trajf = addfile_hytraj(trajfn)
# Create trajectory layer
trajLayer = trajf.trajlayer()
# Open meteorological data file
print 'Open meteorological data file...'
meteofn = os.path.join(meteoDir, 'gdas1.mar15.w5')
print 'Meteorological file: ' + meteofn
meteof = addfile(meteofn)
# Get meteorological data along trajectory
print 'Get meteorological data along trajectory...'
outfn = os.path.join(trajDir, 'traj.txt')
outf = open(outfn, 'w')
outf.write('Lon,Lat,Time,Heigh,pres,PBLH,UWND,VWND,WWND,HGTS,TEMP,RELH,CAPE\n')
pblvar = 'PBLH'
uvar = 'UWND'
vvar = 'VWND'
wvar = 'WWND'
hvar = 'HGTS'
tvar = 'TEMP'
rhvar = 'RELH'
capevar = 'CAPE'
#VORT = hcurl(uvar, vvar)
#divg = hdivg(uvar, vvar)
idx = 0
for tline in trajLayer.shapes():
t = trajLayer.cellvalue('Date', idx)
h = trajLayer.cellvalue('Hour', idx)
t.replace(hour=h)
for ps in tline.getPoints():
lon = ps.X
lat = ps.Y
z = ps.M
pres = ps.Z
pbl = meteof.tostation(pblvar, lon, lat, None, t)
uwnd = meteof.tostation(uvar, lon, lat, pres, t)
vwnd = meteof.tostation(vvar, lon, lat, pres, t)
wwnd = meteof.tostation(wvar, lon, lat, pres, t)
hgt = meteof.tostation(hvar, lon, lat, pres, t)
temp = meteof.tostation(tvar, lon, lat, pres, t)
rh = meteof.tostation(rhvar, lon, lat, pres, t)
cape = meteof.tostation(capevar, lon, lat, None, t)
# vort = meteof.tostation(vortvar, lon, lat, pres, t)
print 'lon: %.3f; lat: %.3f; time: %s; height: %.1f; pres:%.1f; PBLH: %.1f; UWND: %.1f;VWND: %.1f;WWND: %.1f;HGTS: %.1f;TEMP: %.1f;RELH: %.1f;CAPE: %.1f' % (lon, lat, t.strftime('%Y%m%d_%H:%M'), z, pres, pbl, uwnd, vwnd, wwnd, hgt, temp, rh, cape)
line = '%.3f,%.3f,%s,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f' % (lon,lat,t.strftime('%Y%m%d_%H:%M'),z,pres,pbl,uwnd,vwnd,wwnd,hgt,temp,rh,cape)
outf.write(line + '\n')
t = t + datetime.timedelta(hours=-1)
idx += 1
outf.close()
print 'Finish...'
王老师,我输出了大部分资料。发现如下几个问题:
1.HGTS与height差异较大,而且有负值的存在。
2.温度的输出结果,与HYSPLIT自身输出结果不一致。
3.相对湿度存在负值的。
4.其他资料正确与否无法验证。
|
|