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

Creating Regions

Regions(outlines[, numbers, names, abbrevs, …])

class for plotting regions and creating region masks

Mapping Number/ Abbreviation/ Name

Regions.map_keys(self, key)

map from names and abbrevs of the regions to numbers

Selecting

Regions.__getitem__(self, key)

subset of Regions or Region

Plotting

Regions.plot(self[, ax, proj, regions, …])

plot map with with region outlines

Regions.plot_regions(self[, ax, regions, …])

plot map with with srex regions

Creating a Mask

Regions.mask(self, lon_or_obj[, lat, …])

create a grid as mask of a set of regions for given lat/ lon grid

Attributes

Regions.abbrevs

list of abbreviations of the regions

Regions.names

list of names of the regions

Regions.numbers

list of the numbers of the regions

Regions.region_ids

dictionary that maps all names and abbrevs to the region number

Regions.coords

list of coordinates of the region vertices as numpy array

Regions.polygons

list of shapely Polygon/ MultiPolygon of the regions

Regions.centroids

list of the center of mass of the regions

Regions.bounds

list of the bounds of the regions (min_lon, min_lat, max_lon, max_lat)

Regions.bounds_global

global bounds over all regions (min_lon, min_lat, max_lon, max_lat)

Regions.lon_180

if the regions extend from -180 to 180

Regions.lon_360

if the regions extend from 0 to 360

Regions._is_polygon

is there at least one region was passed as (Multi)Polygon

_OneRegion

Creating one Region

_OneRegion(number, name, abbrev, outline[, …])

a single Region, used as member of ‘Regions’

Attributes

_OneRegion.coords

numpy array of the region

_OneRegion.polygon

shapely Polygon or MultiPolygon of the region

_OneRegion.bounds

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

Private Functions

core.utils._wrapAngle360(lon)

wrap angle to [0, 360[.

core.utils._wrapAngle180(lon)

wrap angle to [-180,180[.

core.utils._wrapAngle(lon[, wrap_lon])

wrap the angle to the other base

core.utils._is_180(lon_min, lon_max)