2017-04-18 18 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