Cartopy 连接旋风轨迹图中的端点

问题描述 投票:0回答:0

当我使用 cartopy 在地球上绘制 (lat,lon) 对以获取气旋轨迹时,通过地图边界(180 度)的点会连接起来,所以我在整个地球上画了一条长线。我怎样才能解决这个问题并获得好的曲目?

enter image description here

colormap = "RdYlBu_r"

pole_lon = -180
pole_lat = 90

fig = plt.figure(figsize=(20, 20))

ax = plt.axes(projection=ccrs.PlateCarree())
ax.set_global()


ax.add_feature(cartopy.feature.OCEAN, color='white', zorder=0)
ax.add_feature(cartopy.feature.LAND, color='lightgray',zorder=0,
               linewidth=0.5, edgecolor='black')

ax.gridlines(draw_labels=True, linewidth=0.5, color='gray',
                 xlocs=range(-180,180,15), ylocs=range(-90,90,15))

ax.coastlines(resolution='50m', linewidth=0.3, color='black')
ax.set_title('', fontsize=10, fontweight='bold')

crs = ccrs.RotatedPole(pole_longitude=pole_lon, pole_latitude=pole_lat)
ax.set_extent([-180, 180, -90, 90 ], crs=ccrs.PlateCarree())

g=df.groupby('label')['xlat', 'xlon', 'date']

for i in range(len(c_l)):
    g_tmp=g.get_group(c_l[i]).sort_values(by = 'date', ascending=True)
    lat = g_tmp[['xlat', 'date']]
    lon = g_tmp[['xlon', 'date']]
    ax.plot(lon, lat, '-', transform=crs)
        
#ax.plot(-180, 0, '-', transform=crs)

我尝试对数据进行排序,因为这是谷歌之前唯一建议的,但按日期排序没有帮助,因此我认为这是因为绘图程序。

python cartopy cyclone
© www.soinside.com 2019 - 2024. All rights reserved.