regionmask.from_geopandas

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

Create regionmask.Regions from a geopandas.GeoDataFrame.

Parameters
  • geodataframe (geopandas.GeoDataFrame) – GeoDataFrame to be transformed to a Regions class.

  • numbers (str, 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.

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

  • abbrevs (str, 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”.

  • name (str, optional) – name of the regionmask.Region instance created

  • source (str, optional) – source of the shapefile

  • overlap (bool, 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.

Returns

regionmask.core.regions.Regions