API reference

This page provides an auto-generated summary of regionmask’s API.

Top-level functions

create_mask_contains(lon, lat, coords[, ...]) create the mask of a list of regions, given the lat and lon coords

Regions_cls

Creating Regions

Regions_cls(name, numbers, names, abbrevs, ...) class for plotting regions and creating region masks

Mapping Number/ Abbreviation/ Name

Regions_cls.map_keys(key) map from names and abbrevs of the regions to numbers

Selecting

Regions_cls.__getitem__(key) subset of Regions or Region

Plotting

Regions_cls.plot([ax, proj, regions, ...]) plot map with with srex regions

Creating a Mask

Regions_cls.mask(lon_or_obj[, lat, ...]) create a grid as mask of a set of regions for given lat/ lon grid

Attributes

Regions_cls.abbrevs list of abbreviations
Regions_cls.names list of long names
Regions_cls.numbers list of the numbers of the regions
Regions_cls.region_ids dict mapping all names and abbrevs to the region number
Regions_cls.coords list of coordinates of the region vertices as numpy array
Regions_cls.polygons list of shapely Polygon/ MultiPolygon of the regions
Regions_cls.centroids list of the center of mass of the regions
Regions_cls._is_polygon is there at least one region that was a Polygon/ MultiPolygon

Region_cls

Creating one Region

Region_cls(number, name, abbrev, outline[, ...]) a single Region, used as member of ‘Regions_cls’

Attributes

Region_cls.coords numpy array of the region
Region_cls.polygon shapely Polygon or MultiPolygon of the region

Private Functions

_wrapAngle360(lon) wrap angle to [0, 360[.
_wrapAngle180(lon) wrap angle to [-180,180[.
_wrapAngle(lon[, wrap_lon]) wrap the angle to the other base