regionmask.from_geopandas(geodataframe, *, numbers=None, names=None, abbrevs=None, name='unnamed', source=None, overlap=False)

Create regionmask.Regions from a geopandas.GeoDataFrame.


GeoDataFrame to be transformed to a Regions class.

numbersstr, optional

Name of the column in geodataframe that gives each region its number. This column must not have duplicates. If None (default), takes geodataframe.index.values.

namesstr, optional

Name of the column in shapefile that names a region. Breaks for duplicates. If None (default) uses “Region0”, .., “RegionN”.

abbrevsstr, optional

Name of the column in shapefile that five a region its abbreviation. Breaks for duplicates. If _from_name, a combination of the first letters of region name is taken. If None (default) uses “r0”, .., “rN”.

namestr, optional

name of the regionmask.Region instance created

sourcestr, optional

source of the shapefile

overlapbool, default: False

Indicates if (some of) the regions overlap. If True mask_3D will ensure overlapping regions are correctly assigned to grid points while mask will error (because overlapping regions cannot be represented by a 2D mask).

If False (default) assumes non-overlapping regions. Grid points will silently be assigned to the region with the higher number (this may change in a future version).

There is (currently) no automatic detection of overlapping regions.