- 积分
- 56821
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|

楼主 |
发表于 2024-12-19 23:07:40
|
显示全部楼层
参考这个:
 - print('Open data files...')
- f_air = addfile('D:/Temp/nc/air.2011.nc')
- f_uwnd = addfile('D:/Temp/nc/uwnd.2011.nc')
- f_vwnd = addfile('D:/Temp/nc/vwnd.2011.nc')
- f_rhum = addfile('D:/Temp/nc/rhum.2011.nc')
- print('Read data array...')
- stidx = 0
- etidx = 20
- levels = f_rhum['level'][:] # rhum has less levels
- nlev = len(levels)
- lonlim = '60:140'
- latlim = '10:60'
- air = f_air['air'][stidx:etidx,0:nlev,latlim,lonlim]
- uwnd = f_uwnd['uwnd'][stidx:etidx,0:nlev,latlim,lonlim]
- vwnd = f_vwnd['vwnd'][stidx:etidx,0:nlev,latlim,lonlim]
- rhum = f_rhum['rhum'][stidx:etidx,0:nlev,latlim,lonlim]
- # Calculate
- print('Calculate...')
- prs = 700
- g = 9.8
- es = 6.112*exp(17.67*(air-273.16)/(air-29.65))
- qs = 0.62197*es/(prs-0.378*es)
- q = qs*rhum/100
- qhdivg = meteolib.divergence(q*uwnd/g, q*vwnd/g)
- # Get data at a location
- lon = 120
- lat = 40
- data = qhdivg[:,:,str(lat),str(lon)]
- data = np.rot90(data)
- tt = data.dimvalue(1)
- height = meteolib.pressure_to_height_std(levels)
- # Plot
- print('Plot...')
- contourf(tt, height, data, 20, extend='both')
- colorbar()
- xaxis(axistype='time')
- yticks(height, levels)
- title('Water Vapor Flux Divergency (Lon: {}, Lat: {})'.format(lon, lat))
|
|