- 积分
- 1102
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-11-24
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2017-1-24 08:03:56
|
显示全部楼层
王老师,我已经完成了平均值计算,也把结果保存成了ARL格式,但是最后data grid的信息(Pole pnt lat/lon,Tan lat/cone,Syn pnt x/y,Syn pnt lat/lon)变了,请问这个如何设置呢?(meteof[5]是2010年的原数据)
outfn = os.path.join(meteoDir, 'test1.arl')
arlf = addfile(outfn, 'c', dtype='arl')
inf = meteof[5]
avar2d = ['PRSS']
avar3d = ['UWND','VWND','HGTS','TEMP','WWND','RELH','TKEN']
avg3d = ['dyUWND','dyVWND','dyHGTS','dyTEMP','dyWWND','dyRELH','dyTKEN']
wv = inf['UWND']
nx = 185
ny = 129
levels = [1000,975,950,925,900,875,850,825,800,775,750,725,700,\
650,600,550,500,450,400,350,300,250,200,150,100,50]
nz = len(levels)
arlf.setlevels(levels)
arlf.set2dvar(avar2d)
arlf.setx(wv.dimvalue(wv.ndim - 1))
arlf.sety(wv.dimvalue(wv.ndim - 2))
for l in levels:
arlf.set3dvar(avar3d)
tNum = 15
fhour = 0
for t in range(0, 15):
print 'Time index: ' + str(t)
atime = inf.gettime(t*8)
print atime.strftime('%Y-%m-%d')
dhead = arlf.getdatahead(inf.proj, 'EDAS', 2, fhour)
arlf.writeindexrec(atime, dhead)
ksumlist = []
ksums = []
for avname in avar2d:
print avname
gdata = PRSS[t*8,:,:]
ksum = arlf.writedatarec(atime, 0, avname, fhour, 99, gdata)
ksums.append(ksum)
ksumlist.append(ksums)
# Write 3d variables
for lidx in range(0, nz):
ksums = []
print lidx
for avname,i in zip(avar3d, range(0,7)):
print avname,i
gdata = meteovar[t,lidx,:,:]
ksum = arlf.writedatarec(atime, lidx + 1, avname, fhour, 99, gdata)
ksums.append(ksum)
ksumlist.append(ksums)
arlf.writeindexrec(atime, dhead, ksumlist)
fhour += 24
arlf.close()
print 'Finished! |
|