掠夺海洋覆盖土地

时间:2018-01-29 14:37:24

标签: python cartopy

编辑:似乎是一个已知问题(https://github.com/SciTools/cartopy/issues/803#issuecomment-272286945),带有某些地图投影。

出于某种原因,NaturalEarth海洋覆盖了大陆,如下例所示。如果我绘制'physical', 'land'它的行为符合预期(土地被填满),但对于'physical', 'ocean'我会期望相反,但相反,一切都被填满。有谁知道为什么会发生这种情况,和/或如何只填充海洋?

我也试过ax.add_feature(cartopy.feature.OCEAN),但Cartopy崩溃了(......)

import cartopy
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as pl

projection = ccrs.LambertConformal(central_longitude=4.9, central_latitude=52)

ax = pl.subplot(121, projection=projection)
ax.add_feature(cfeature.NaturalEarthFeature('physical', 'land', '50m', edgecolor='face', facecolor='g'))
ax.set_extent([-8, 17, 42, 60], ccrs.PlateCarree())

ax = pl.subplot(122, projection=projection)
ax.add_feature(cfeature.NaturalEarthFeature('physical', 'ocean', '50m', edgecolor='face', facecolor='g'))
ax.set_extent([-8, 17, 42, 60], ccrs.PlateCarree())

enter image description here

修改

似乎是投射问题;使用PlateCarree()它按预期工作:

import cartopy
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as pl

projection = ccrs.LambertConformal(central_longitude=4.9, central_latitude=52)

ax = pl.subplot(221, projection=projection)
ax.add_feature(cfeature.NaturalEarthFeature('physical', 'land', '50m', edgecolor='face', facecolor='g'))
ax.set_extent([-8, 17, 42, 60], ccrs.PlateCarree())

ax = pl.subplot(222, projection=projection)
ax.add_feature(cfeature.NaturalEarthFeature('physical', 'ocean', '50m', edgecolor='face', facecolor='g'))
ax.set_extent([-8, 17, 42, 60], ccrs.PlateCarree())

projection = ccrs.PlateCarree()

ax = pl.subplot(223, projection=projection)
ax.add_feature(cfeature.NaturalEarthFeature('physical', 'land', '50m', edgecolor='face', facecolor='g'))
ax.set_extent([-8, 17, 42, 60], ccrs.PlateCarree())

ax = pl.subplot(224, projection=projection)
ax.add_feature(cfeature.NaturalEarthFeature('physical', 'ocean', '50m', edgecolor='face', facecolor='g'))
ax.set_extent([-8, 17, 42, 60], ccrs.PlateCarree())

enter image description here

0 个答案:

没有答案