2017-04-18 67 views
1

我有数据是-100o - 30o lon和0o - 80o lat。cartopy - AlbersEqualArea限制区域使用lon和lat

我想使用投影来仅显示此区域。

在我的头上,我想表明这样一个情节:

regional map

然而,当我尝试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()) 

我得到的地图显示:

regional AEA map

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

干杯, 雷

回答

3

如果你想有一个非矩形的边界,你必须自己定义它。像下面的内容可能会为你工作:

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() 

enter image description here

+0

感谢教我关于边界。使用网格线将lon和lats添加到绘图似乎不可行。我在使用PlateCarree(PC)和AlbersEqualArea(AEA)之间有两个心思。我正在研究北大西洋的季节性预报,而AEA给季节预报良好的热带地区提供了更多的“权重”。不过,我正在看NAO,PC可能会更好地突出该地区。使用AxesGrid PC可能会更好,而lon和lat ticks是一个优势。 电脑地图:http://imgur.com/a/GcWFr AEA地图:http://imgur.com/a/Uxl1n 您是否有偏好? –

-1

我想,也许你需要AlbersEqualArea添加为对剧情的变换,也许更像this