如何使用 Python 中的 Cartopy 将兰伯特等角投影更改为立体投影?
我有兰伯特共形投影中变量 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:
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!
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论