如何使用 Python 中的 Cartopy 将兰伯特等角投影更改为立体投影?

发布于 2025-01-16 15:38:41 字数 1389 浏览 2 评论 0原文

我有兰伯特共形投影中变量 z 的 proj 字符串 (+proj=lcc +lat_0=40 +lon_0=-100 +lat_1=49 +lat_2=77 +x_0=0 +y_0=0 +datum=WGS84 +units =m +no_defs +type=crs)。当我在兰伯特等角投影中绘制它时,它看起来没问题: 在此处输入图像描述

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

dx = dy = 12500
x = np.arange(-2137500, +2612500, +dx)
y = np.arange(+5400000, +1100000, -dy)

#### x.shape: 380, y.shape: 344, z.shape: 344*380

fig = plt.figure(figsize=(9, 9))
ax = plt.axes(projection=ccrs.LambertConformal())
ax.gridlines()
ax.add_feature(cfeature.LAND, facecolor='black')
kw= dict(central_longitude=-100, central_latitude=40.0, false_easting=0.0, false_northing=0.0, standard_parallels=(49,77))
cs = ax.pcolormesh(x, y, z, cmap='cividis', transform=ccrs.LambertConformal(**kw))

但是当我在立体投影中绘制它时,它不匹配! 在此处输入图像描述

fig = plt.figure(figsize=(9, 9))
ax = plt.axes(projection=ccrs.NorthPolarStereo(central_longitude=0))
cs = ax.coastlines(resolution='110m', linewidth=0.5)
ax.gridlines()
ax.add_feature(cfeature.LAND, facecolor='black')
ax.set_extent([-120, 0, 50, 60], crs=ccrs.PlateCarree())
kw = dict(central_latitude=40, central_longitude=-100)
cs = ax.pcolormesh(x, y, z, cmap='cividis', transform=ccrs.Stereographic(**kw))

I have the proj string for a variable z in the Lambert Conformal projection (+proj=lcc +lat_0=40 +lon_0=-100 +lat_1=49 +lat_2=77 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +type=crs). When I plot it in the Lambert Conformal projection it seems ok:
enter image description here

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

dx = dy = 12500
x = np.arange(-2137500, +2612500, +dx)
y = np.arange(+5400000, +1100000, -dy)

#### x.shape: 380, y.shape: 344, z.shape: 344*380

fig = plt.figure(figsize=(9, 9))
ax = plt.axes(projection=ccrs.LambertConformal())
ax.gridlines()
ax.add_feature(cfeature.LAND, facecolor='black')
kw= dict(central_longitude=-100, central_latitude=40.0, false_easting=0.0, false_northing=0.0, standard_parallels=(49,77))
cs = ax.pcolormesh(x, y, z, cmap='cividis', transform=ccrs.LambertConformal(**kw))

But when I plot it in Stereographic projection, it does not match!
enter image description here

fig = plt.figure(figsize=(9, 9))
ax = plt.axes(projection=ccrs.NorthPolarStereo(central_longitude=0))
cs = ax.coastlines(resolution='110m', linewidth=0.5)
ax.gridlines()
ax.add_feature(cfeature.LAND, facecolor='black')
ax.set_extent([-120, 0, 50, 60], crs=ccrs.PlateCarree())
kw = dict(central_latitude=40, central_longitude=-100)
cs = ax.pcolormesh(x, y, z, cmap='cividis', transform=ccrs.Stereographic(**kw))

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

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

发布评论

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