【问题标题】:Contouring with cartopy: ValueError: invalid transform: Spherical contouring is not supported使用 cartopy 进行轮廓:ValueError:无效变换:不支持球形轮廓
【发布时间】:2012-11-19 09:55:23
【问题描述】:

我想在用 cartopy 生成的地图上绘制等高线。如果我在以下位置运行示例:

http://scitools.org.uk/cartopy/docs/latest/matplotlib/introductory_examples/03.contours.html

使用从 github 签出的最新代码我得到:

ValueError: invalid transform: Spherical contouring is not supported -  
consider using PlateCarree/RotatedPole.

应该怎么做呢?

(作为对原始公告的回应http://matplotlib.1069221.n5.nabble.com/ANN-Cartopy-A-new-mapping-library-using-matplotlib-td39886.html)

【问题讨论】:

    标签: python matplotlib cartopy


    【解决方案1】:

    与代码库相比,http://scitools.org.uk/cartopy/docs/latest/matplotlib/introductory_examples 下的 cartopy 文档中提供的示例已经过时。有一张开发票可以更新所有示例 (https://github.com/SciTools/cartopy/issues/128)。

    在这种情况下,只需替换该行

    plt.contourf(lons, lats, data, transform=ccrs.Geodetic())
    

    与

    plt.contourf(lons, lats, data, transform=ccrs.PlateCarree())
    

    该示例应该可以再次运行。

    matplotlib/cartopy introductory section of the cartopy docs 有 有一个可能感兴趣的轮廓示例http://scitools.org.uk/cartopy/docs/latest/matplotlib/advanced_plotting.html#contour-plots 生成的图像:

    HTH,

    【讨论】:

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