cartopy-使用lon和lat的AlbersEqualArea限制区域

Ray*_*ell 2 python cartopy

我的数据是-100o-30o lon和0o-80o lat。

我只想使用投影来显示该区域。

在我的脑海中,我想展示这样的情节:

区域地图

但是,当我按以下方式尝试AlbersEqualArea投影时:

plt.figure(figsize=(5.12985642927, 3))
ax = plt.axes(projection=ccrs.AlbersEqualArea(central_longitude=-35, central_latitude=40, standard_parallels=(0, 80)))    
ax.set_extent([lon180[0], lon180[-1], lat[0], lat[-1]], ccrs.Geodetic())
Run Code Online (Sandbox Code Playgroud)

我得到一张地图,显示:

区域AEA地图

显示我拥有数据的区域的最佳方法是什么?

干杯,雷

ajd*_*son 5

如果要具有非矩形边界,则必须自己定义。类似以下内容可能适用于您:

import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import matplotlib.path as mpath

proj = ccrs.AlbersEqualArea(central_longitude=-35,
                            central_latitude=40,
                            standard_parallels=(0, 80))
ax = plt.axes(projection=proj)    
ax.set_extent([-100, 30, 0, 80], crs=ccrs.PlateCarree())
ax.coastlines()

# Make a boundary path in PlateCarree projection, I choose to start in
# the bottom left and go round anticlockwise, creating a boundary point
# every 1 degree so that the result is smooth:
vertices = [(lon, 0) for lon in range(-100, 31, 1)] + \
           [(lon, 80) for lon in range(30, -101, -1)]
boundary = mpath.Path(vertices)
ax.set_boundary(boundary, transform=ccrs.PlateCarree())

plt.show()
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明