- 积分
- 277
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2019-1-7
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如题,现在有水汽的nc文件,之前看到论坛里的大哥用脚本计算水汽距平,可是实在是用不明白,自己想用循环把距平算出来然后画图,可是循环以后也画不了,有没有人实例指导一下,谢谢了。传送门在这里http://bbs.06climate.com/forum.p ... p;page=1#pid1006206,这是那位大神写的贴子。可是我的水汽资料是4维的,time,lev,lat,lon,用这个脚本时候总提示CalculateAnomaly-Warning(1): The dimension of array <data> should be three(3). The current dimension is 4 .
from netCDF4 import Dataset
import matplotlib.pyplot as plt
from ClimateAnalysis import *
infile = 'f:/merra2/QV/MERRA2_400.inst3_3d_asm_Np.20120610.SUB.nc4'
fopen = Dataset(infile)
lons = fopen.variables['lon'][:]
lats = fopen.variables['lat'][:]
lets = fopen.variables['lev'][:]
time = fopen.variables['time'][0]
QV = fopen.variables['QV'][:,:,:,:]
missing_value = fopen.variables['QV']._FillValue
sst=CalculateAnomaly(QV,'185401')
plt.pcolormesh(lons, lats, sst[0,:,:,:])
plt.show()
上边是我根据他的贴子引用的自己的文件,不知道该怎么办,求助一下。
|
|