Countries/ States (NaturalEarth)
The outline of the countries are obtained from Natural Earth. They are automatically downloaded, cached and opened with geopandas. The following countries and regions are defined in regionmask.
Countries 1:110m
Countries 1:50m
US States 1:50m
US States 1:10m
Warning
regionmask.defined_regions.natural_earth
is deprecated.
Please use natural_earth_v4_1_0
or natural_earth_v5_0_0
instead.
Be careful when working with the different versions of NaturalEarth regions. Some polygons and regions have changed and the numbering of the regions may be different.
Note
A mask obtained with a fine resolution dataset is not necessarily better. Always check your mask!
Import regionmask:
In [1]: import regionmask
Countries
In [2]: regionmask.defined_regions.natural_earth_v5_0_0.countries_110.plot(add_label=False);
US States
In [3]: states = regionmask.defined_regions.natural_earth_v5_0_0.us_states_50
In [4]: states.plot(add_label=False);
Also create a mask for a 1° grid over the US:
In [5]: import numpy as np
# create a grid
In [6]: lon = np.arange(200.5, 325)
In [7]: lat = np.arange(74.5, 14, -1)
In [8]: mask = states.mask(lon, lat)
In [9]: states.plot(add_label=False);
In [10]: mask.plot(add_colorbar=False)
Out[10]: <cartopy.mpl.geocollection.GeoQuadMesh at 0x7f463cb6e050>