- 积分
- 55960
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
MeteoInfo 3.9.1版本在meteolib包中增加了cross_section函数,可以通过起始和结束点的经纬度获取三维或者二维格点数据两点连线处的剖面数据。
详见MeteoInfo公众号:https://mp.weixin.qq.com/s/_AkarrVz4lnP5cdj3l1QLg
- #Read data
- fn = os.path.join(migl.get_sample_folder(), 'GrADS', 'model.ctl')
- f = addfile(fn)
- data = f['U'][0]
- lev1 = data.dimvalue(0)
- lev2 = meteo.pressure_to_height_std(lev1)
- lev2 = lev2 / 1000
- data.setdimvalue(0, lev2)
- f1 = addfile('D:/Temp/nc/elev.0.25-deg.nc')
- elev = f1['data'][0,::-1]
- lon1 = 0; lat1 = -30; lon2 = 180; lat2 = 60
- n = 73
- terrain = meteo.cross_section(elev, start=(lon1, lat1), end=(lon2, lat2),
- steps=n)[0]
- terrain[terrain<0] = 0
- terrain = terrain / 1000.0
- csdata, x, y = meteo.cross_section(data, start=(lon1, lat1),
- end=(lon2, lat2), steps=n)
- #Plot
- subplot(2,1,1)
- yaxis(tickin=False)
- xaxis(tickin=False)
- yaxis(location='right', tickvisible=False)
- xaxis(location='top', tickvisible=False)
- levs = arange(-10, 81, 10)
- layer = contourf(x, lev2, csdata, levs)
- fill_between(x, terrain, color='gray')
- plot(x, terrain, color='k')
- ylabel('Hight(km)')
- xlabel('Longitude')
- ylim(0, 16)
- colorbar(layer, aspect=25)
- subplot(2,1,2,axestype='map')
- lat = [lat1, lat2]
- lon = [lon1, lon2]
- geoshow(lat, lon, size=2, color='b')
- geoshow('country')
- xlim(-10, 190)
- ylim(-55, 65)
|
|