我想在用 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 结果图像:
HTH,
关于python - 用 cartopy : ValueError: invalid transform: Spherical contouring is not supported 轮廓,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13657748/