- 积分
- 83
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2022-11-7
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
有没有友友知道为什么等值线画的出来风场画不出来呢
assert len(z_levels) <= len(axs), "Not enough axes for all z_levels"
# 多图循环
for index, z_level in enumerate(z_levels):
ax = axs[index] if index < len(axs) else None
if ax is None:
break
height_index = np.where(z_data[:, 0, 0] == z_level)[0]
if height_index.size == 0:
print(f"没有找到匹配的 z_level: {z_level},因此跳过该层次的绘图。")
continue
if height_index.size > 0:
height_index = height_index[0]
u_slice = u_data[height_index, :, :]
v_slice = v_data[height_index, :, :]
z_slice = z_data[height_index, :, :]
t_slice = t_data[height_index, :, :]
m1 = ax.contour(lon, lat, z1, colors="k", linewidths=1,
transform=ccrs.PlateCarree(),
levels=np.arange(100, 1800, 8))
m2 = ax.contour(lon, lat, t1, colors="r", linewidths=1,
transform=ccrs.PlateCarree(),
levels=np.arange(-80, 40, 8)) # 等值线
ax.clabel(m1, fmt='%1.00f', fontsize=20, colors="k")
ax.clabel(m2, fmt='%1.00f', fontsize=20, colors="r")
ax.barbs(lon2d[::15, ::15], lat2d[::15, ::15], u_slice[::15, ::15], v_slice[::15, ::15],
barbcolor=['k'],
linewidth=0.5,
length=5,
barb_increments=dict(half=2, full=4, flag=20))
|
|