regionmask._OneRegion¶
-
class
regionmask.
_OneRegion
(number, name, abbrev, outline, centroid=None)¶ a single Region, used as member of ‘Regions’
-
__init__
(self, number, name, abbrev, outline, centroid=None)¶ - 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.
centroid (1x2 iterable, optional.) – Center of mass of this region. If not provided is calculated as (Multi)Polygon.centroid. Position of the label on map plots.
Example
_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, centroid=[0.5, 0.75])
Methods
__init__
(self, number, name, abbrev, outline)- param number
Number of this region.
Attributes
bounds of the regions ((Multi)Polygon.bounds (min_lon, min_lat, max_lon, max_lat)
numpy array of the region
shapely Polygon or MultiPolygon of the region
-