- 积分
- 1462
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2020-7-14
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
请问大家有绘制wrfout填色图出现投影问题吗?新手小白,刚接触这个数据,绘图的程序如下,请问该怎么调整:
ds = nc.Dataset(r'H:\wrfout_NCP\wrfout_d02_2022-08-04_06_00_00')
# 提取位势高度和压力场
gh = getvar(ds, 'geopotential') # 提取WRF netCDF 变量 # model height
p = getvar(ds, 'pressure') # 单位hPa (29, 216, 216)
ua=getvar(ds, 'ua')
va=getvar(ds, 'va')
# 计算 500 mb 位势高度
gh_850 = interplevel(gh, p,850)
gh_850=gh_850/9.80665
gh_500 = interplevel(gh, p,500)
gh_500=gh_500/9.80665
#插值到气压层的风场
ua_850 = interplevel(ua, p,850)
ua_500 = interplevel(ua, p,500)
va_850 = interplevel(va, p,850)
va_500 = interplevel(va, p,500)
# 提取经纬度坐标
lon=getvar(ds, "XLONG")
lat=getvar(ds, "XLAT")
fig = plt.figure(figsize=[15,4])
proj = ccrs.PlateCarree()
gs = GridSpec(2, 5, figure=fig,hspace=0.01, wspace=0.04,height_ratios= [1.1,0.1])
# 调整画布边缘留白
plt.subplots_adjust(left=0.05, right=0.95, top=0.97, bottom=0.07)
ax1 = fig.add_subplot(gs[0, 0], projection=proj)
ax1.set_extent([105, 125, 30, 45], crs=proj)#[70, 136, 15, 55];[110, 128, 30, 48]
ax1.set_xticks(np.arange(110, 125, 5), crs=proj)#(70, 140, 20):(110, 130, 5)
ax1.set_yticks(np.arange(35, 45,5), crs=proj)
ax1.xaxis.set_major_formatter(LongitudeFormatter(zero_direction_label=False))
ax1.yaxis.set_major_formatter(LatitudeFormatter())
geo_levels = np.arange(1370,1532,5)#(620,780,5)
cf=ax1.contourf(lon,lat, gh_850, levels=geo_levels,cmap=cmaps.WhiteBlueGreenYellowRed)
|
-
|