gpt4 book ai didi

python - Cartopy 倒钩无法正常工作

转载 作者:行者123 更新时间:2023-12-01 09:33:02 26 4
gpt4 key购买 nike

我正在尝试在北太平洋投影上绘制 250 hPa 位势高度、1000 hPa 可降水量和 250 hPa 风速。当尝试使用倒刺时,我没有收到错误,但倒刺并没有实际显示在 map 上。我认为这可能与我的数据投影到 cartopy 投影有关,但我对 cartopy 很陌生,不太明白发生了什么。如果有人注意到我的预测总体上是搞砸的,我不会介意一些方向。谢谢!

def plotMap():

proj = ccrs.LambertConformal(central_longitude=-165, central_latitude=30, standard_parallels=[53])

fig, ax = plt.subplots(subplot_kw=dict(projection=proj))

ax.set_extent([235 ,160 , 5, 60], crs=ccrs.PlateCarree())
ax.add_feature(cfeature.LAND, facecolor='0.9')
ax.add_feature(cfeature.LAKES, alpha=0.9)
ax.add_feature(cfeature.BORDERS, zorder=10)
ax.add_feature(cfeature.COASTLINE, zorder=10)

states_provinces = cfeature.NaturalEarthFeature(category='cultural',
name='admin_1_states_provinces_lines', scale='50m', facecolor='none')

ax.add_feature(states_provinces, edgecolor='gray', zorder=10)

ax.gridlines(xlocs=np.arange(0,361,20), ylocs=np.arange(-80,90,20))

return fig, ax

fig, ax = plotMap()




hght_levels = np.arange(9500,11250,250)
hght_contour=ax.contour(lon, lat, g, colors='k', levels=hght_levels,
linewidths=1, zorder=3, transform = ccrs.PlateCarree())

wind_levels = np.arange(0, 110, 10)
wind_contour = ax.contour(lon, lat, wind, levels = wind_levels,
linewidths=5, zorder=0.8, transform = ccrs.PlateCarree())

pwat_levels = np.linspace(0, 50, 9)
pwat_contour = ax.contourf(lon, lat, pwat, levels = pwat_levels,
cmap=plt.cm.plasma, zorder=1.0, transform =
ccrs.PlateCarree())
cb = plt.colorbar(pwat_contour, shrink=0.5)
cb.set_ticklabels(pwat_levels)

urel = u.values*1.944
vrel = v.values*1.944
ax.barbs(lon, lat, urel, vrel, regrid_shape=12 transform=ccrs.LambertConformal())

plt.clabel(hght_contour, hght_levels, zorder=20, inline=1,inline_spacing=3,
fmt='%1i', fontsize=12)


fig

The plot

enter image description here

最佳答案

您对调用 barbs 的投影将 transform 参数提供为 LambertConformal(),但看起来您正在传递纬度并且位置的经度值。将 transform 更改为 PlateCarree(),如在其他绘图方法中使用的那样。

关于python - Cartopy 倒钩无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49786173/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com