python - 用 cartopy : ValueError: invalid transform: Spherical contouring is not supported 轮廓

标签 python matplotlib cartopy

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

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

使用 github 的最新代码 checkout 我得到:

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 的回应)

最佳答案

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 结果图像:

output from linked example

HTH,

关于python - 用 cartopy : ValueError: invalid transform: Spherical contouring is not supported 轮廓,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13657748/

相关文章:

python - 如何在自定义Python记录器中获取进程、线程名称、级别名称

与 Selenium (RC) 的 Javascript 通信

python - 使用日期和 int 值构建散点图的问题

python - Matplotlib 在 GUI 中崩溃

python - 高纬度非矩形投影不会出现 Cartopy 标签

python - 将矩形添加到使用 Cartopy python 制作的 map 中以选择子空间

python - 如何在cartopy中的 map 上特定点绘制散点图

python - 使用 pyInstaller 创建一个使用 UAC 的 exe

python - pygame中面向对象的圆形按钮?

Python:绘制时间增量和累积值