- 积分
- 55955
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2016-12-7 14:19:13
|
显示全部楼层
目前MeteoInfoLab还没有类似NCL的addfiles函数同时读入多个数据文件(以后会考虑加上此项功能),可以用循环来处理。
- datadir = 'E:/Temp'
- st = datetime.datetime(2009,1,1,0)
- et = datetime.datetime(2009,1,1,21)
- tn = 8
- data = None
- i = 0
- while st <= et:
- fn = os.path.join(datadir, 'GLDAS_NOAH10_3H.A' + st.strftime('%Y%m%d.%H') + \
- '00.020.grb')
- print fn
- f = addfile(fn)
- ws = f['Wind_Speed_surface'][0,:,:]
- if i == 0:
- yn = ws.dimlen(0)
- xn = ws.dimlen(1)
- data = zeros((tn,yn,xn))
- data[i,:,:] = ws.array
- i += 1
- st = st + datetime.timedelta(hours=3)
- data = mean(data, axis=0)
- lat = ws.dimvalue(0)
- lon = ws.dimvalue(1)
- #Plot
- axesm()
- lworld = shaperead('D:/Temp/map/country1.shp')
- geoshow(lworld)
- layer = imshowm(lon, lat, data)
- colorbar(layer)
- title('Mean wind speed (' + et.strftime('%Y-%m-%d') + ')')
|
|