使用Imshow和Cartopy正确地将图像与正弦投影对齐

发布于 2025-01-28 08:50:40 字数 769 浏览 4 评论 0 原文

我正在尝试使用iMshow绘制使用正弦投影的图像,但是如果我使用 transform = ccrs.sinusoidal(central_longitude = 128)它根本不起作用,并且使用transform = ccrs.platecarree( )海岸线和图像不符合。这是我的代码:

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import numpy as np

plt.figure(figsize=(8, 8))
ax = plt.axes(projection=ccrs.PlateCarree())
    
img_extent = (122.8109, 133.2922, 32.8286, 43.1708)
img = plt.imread('Korea.A2004004.0445.250m.jpg')
ax.coastlines(resolution='10m')
ax.imshow(img, origin='upper', extent=img_extent, transform=ccrs.PlateCarree())

plt.show()

图像来自:

I'm trying to plot an image with a Sinusoidal projection using imshow but if I use the transform=ccrs.Sinusoidal(central_longitude=128) it's not working at all and using the transform=ccrs.PlateCarree() the coastlines and image are not aligned. This is my code:

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import numpy as np

plt.figure(figsize=(8, 8))
ax = plt.axes(projection=ccrs.PlateCarree())
    
img_extent = (122.8109, 133.2922, 32.8286, 43.1708)
img = plt.imread('Korea.A2004004.0445.250m.jpg')
ax.coastlines(resolution='10m')
ax.imshow(img, origin='upper', extent=img_extent, transform=ccrs.PlateCarree())

plt.show()

Image is from: https://eoimages.gsfc.nasa.gov/images/imagerecords/69000/69679/Korea.A2004004.0445.250m.jpg

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文