如何使用 cartopy & 转换图像里奥克斯阵列...?
我想读取带有 rioxarray (或 rasterio)的图像(带有 georef 信息),并使用 cartopy 和转换来绘制它:
import rioxarray
fn2 = 'https://eoimages.gsfc.nasa.gov/images/imagerecords/144000/144898/BlackMarble_2016_01deg_geo.tif'
da0 = rioxarray.open_rasterio(fn2)
import matplotlib.pyplot as plt
fig0 = plt.figure()
import cartopy
proj0 = cartopy.crs.LambertConformal(-100)
ax0 = fig0.add_subplot(111, projection = proj0)
ax0.coastlines()
ax0.gridlines()
da0.plot.imshow(ax = ax0, transform = da0.rio.crs)
plt.show()
...但我收到错误:
ValueError:预期有一个投影子类。无法处理
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为 cartopy 仅处理定义为 cartopy.CRS 子类的投影(据我所知,尚不支持通过 wkt-strings 等定义的任意投影)。
但是,我是EOmaps 的开发,它基于 cartopy 但处理直接使用 pyproj 重新投影。
因此,它完全能够使用任意输入投影:
This is because cartopy only deals with projections defined as subclasses of
cartopy.CRS
(as far as i know there's not yet a support for arbitrary projections defined via wkt-strings etc.)However, I'm the dev of EOmaps which is based on cartopy but handles re-projections directly with
pyproj
.As such it is perfectly capable of using arbitrary input projections: