3

我想在用 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

4

1 回答 1

4

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

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

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

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

并且该示例应该再次起作用。

cartopy 文档的matplotlib/cartopy 介绍部分有一个可能感兴趣的轮廓示例http://scitools.org.uk/cartopy/docs/latest/matplotlib/advanced_plotting.html#contour-plots 结果图像:

链接示例的输出

高温下,

于 2012-12-01T08:24:23.487 回答