regionmask.from_geopandas

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

Create regionmask.Regions from a geopandas.GeoDataFrame.

Parameters:
geodataframegeopandas.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 | None, default: None

Indicates if (some of) the regions overlap and determines the behaviour of the mask methods.

  • If True mask_3D ensures overlapping regions are correctly assigned to grid points, while mask raises an Error (because overlapping regions cannot be represented by a 2 dimensional mask).

  • If False assumes non-overlapping regions. Grid points are silently assigned to the region with the higher number.

  • If None (default) checks if any gridpoint belongs to more than one region. If this is the case mask_3D correctly assigns them and mask raises an Error.

Returns:
regionmask.core.regions.Regions