爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 99|回复: 0

[求助] python

[复制链接]

新浪微博达人勋

发表于 2024-4-18 20:33:57 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

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))  



密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表