【问题标题】:cartopy contours don't wrap around longitudescartopy 轮廓不环绕经度
【发布时间】:2022-02-02 01:01:07
【问题描述】:

我正在尝试使用 cartopy 在北极立体投影中绘制海冰等高线,但有一种奇怪的行为,即等高线不会以 180 度环绕。我查看了另一篇帖子 (Strange behavior with contours in Cartopy polar stereographic plot),该帖子建议将我的经度更改为 0-360,但如果我这样做,我会遇到同样的问题,但经度为 0 而不是 180。

(使用相同的数据,我在使用底图时从未遇到过这个问题)

sea_ice, LO 和 LA 是大小为 (448, 304) 的矩阵,最重要的是,LA 和 LO 的 lat 和 lon 间隔不规则,它是极坐标投影,所以我不能使用 add_cyclic_point。

这是我的绘图代码:

fig = plt.figure(figsize=(8,8))
ax = plt.axes(projection=cartopy.crs.NorthPolarStereo(true_scale_latitude=70))
gl = ax.gridlines(draw_labels=True)
gl.xlabel_style = {'size': 16,'rotation':0}
ax.coastlines('10m')
ax.add_feature(cfeature.RIVERS)
ax.set_extent([-180, 180, 55, 90], crs=cartopy.crs.PlateCarree())
ax.add_feature(cfeature.LAND, facecolor = '0.75')
ax.add_feature(cfeature.RIVERS,facecolor='blue')

cc=plt.contour(LO, LA, sea_ice, levels=[15], colors='m', linewidth=3, transform=cartopy.crs.PlateCarree())

Contours with my longitudes from -180 to 180

Contours with my longitude from 0 to 360

【问题讨论】:

    标签: python contour cartopy


    【解决方案1】:

    我们都使用相同的 NSIDC 每日数据集。

    试试

    ax.contour(xgrid, ygrid, sea_ice, [15], transform=cartopy.crs.epsg(3411))
    

    同意 lats、lons 和 sea_ice 是 xgrid 和 ygrid 的 2D,而不是 lat 和 lon。然后,您调用特定于数据集 epsg 标记的转换,该 aggributes 建议为 3411。

    srid : urn:ogc:def:crs:EPSG::3411

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-09
      • 2019-11-07
      • 2012-11-19
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多