regionmask._OneRegion

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

a single Region, used as member of Regions

Parameters:
numberint

Number of this region.

namestring

Long name of this region.

abbrevstring

Abbreviation of this region.

outlineNx2 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)
>>> r
<regionmask._OneRegion: Unit Square (USq / 1)>

or by passing shapely Polygons:

>>> from shapely.geometry import Polygon
>>> poly = Polygon(outl)
>>> r = _OneRegion(1, 'Unit Square', 'USq', poly)
>>> r
<regionmask._OneRegion: Unit Square (USq / 1)>
__init__(number, name, abbrev, outline)

Methods

__init__(number, name, abbrev, outline)

Attributes

bounds

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

centroid

coords

numpy array of the region