Countries/ States (NaturalEarth)
The outline of the countries are obtained from Natural Earth. They are automatically downloaded, cached[1] and opened with geopandas. The following countries and regions are defined in regionmask.
Countries 1:110m
Countries 1:50m
Countries 1:10m
US States 1:50m
US States 1:10m
Note
A mask obtained with a fine resolution dataset is not necessarily better. Always check your mask!
Import regionmask:
In [1]: import regionmask
Countries
Warning
natural_earth_v4_1_0.countries_50
and natural_earth_v5_0_0.countries_50
do not extend all the way to 90°S (see #487).
If Antarctica is of interest, please use natural_earth_v5_1_2.countries_50
instead.
Be careful, however, as the regions may have changed between the natural_earth versions.
Note that countries_10
and countries_110
do not exhibit this problem.
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 0x7f4a0db1f530>
