regionmask._OneRegion

class regionmask._OneRegion(number, name, abbrev, outline)

a single Region, used as member of ‘Regions’

__init__(number, name, abbrev, outline)
Parameters
  • number (int) – Number of this region.

  • name (string) – Long name of this region.

  • abbrev (string) – Abbreviation of this region.

  • outline (Nx2 array of vertices, Polygon or MultiPolygon) – Coordinates/ outline of the region as shapely Polygon/ MultiPolygon or list.

Examples

_OneRegion can be created with numpy-style outlines:

outl = ((0, 0), (0, 1), (1, 1.), (1, 0))
r = _OneRegion(1, 'Unit Square', 'USq', outl)

or by passing shapely Polygons:

from shapely.geometry import Polygon

poly = Polygon(outl)
r = _OneRegion(1, 'Unit Square', 'USq', poly)

Methods

__init__(number, name, abbrev, outline)

Parameters
  • number (int) -- Number of this region.

Attributes

bounds

bounds of the regions ((Multi)Polygon.bounds (min_lon, min_lat, max_lon, max_lat)

centroid

coords

numpy array of the region

polygon

shapely Polygon or MultiPolygon of the region