https://github.com/regionmask/regionmask
create masks of geospatial regions for arbitrary grids
https://github.com/regionmask/regionmask
netcdf python rasterize scientific-computing spatial xarray
Last synced: 7 months ago
JSON representation
create masks of geospatial regions for arbitrary grids
- Host: GitHub
- URL: https://github.com/regionmask/regionmask
- Owner: regionmask
- License: mit
- Created: 2016-07-20T08:45:33.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2025-10-08T05:47:54.000Z (8 months ago)
- Last Synced: 2025-10-21T20:55:42.261Z (7 months ago)
- Topics: netcdf, python, rasterize, scientific-computing, spatial, xarray
- Language: Python
- Homepage: https://regionmask.readthedocs.io/
- Size: 7.05 MB
- Stars: 258
- Watchers: 6
- Forks: 24
- Open Issues: 48
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README

# create *masks* of geospatial *regions* for arbitrary grids
[](https://github.com/regionmask/regionmask/actions?query=workflow%3ACI)
[](https://codecov.io/gh/regionmask/regionmask)
[](https://regionmask.readthedocs.io/en/stable/?badge=stable)
[](https://pypi.python.org/pypi/regionmask/)
[](https://anaconda.org/conda-forge/regionmask)
[](https://doi.org/10.5281/zenodo.10849860)
When working with gridded data such as climate model output or reanalysis data it is
often important to create regional averages, e.g., over countries, continents or
regions defined in the literature. To do so we need to know for each grid point to which
region it belongs to.
**regionmask** is a python package that:
- can be used to create *masks* of (geo)spatial *regions* for arbitrary (longitude and latitude) grids. These masks indicate which region a gridpoint belongs to and can then be used to aggregate gridded data over the regions. The masks come in three variants:
- 2D integer masks
- 3D boolean masks
- 3D approximate fractional masks
- takes great care to create consistent masks for
- region edges and interiors
- overlapping regions
- contains a number of defined regions, including:
- countries
- landmasks
- regions used in the scientific literature
- can plot figures of these regions
- supports using arbitrary existing or user-defined region definitions:
- regions defined as shapefiles can be accessed via geopandas
- user-defined regions can be created via numpy or shapely
## Documentation
Learn more about regionmask in its official documentation at https://regionmask.readthedocs.io
## Get in touch
Don't hesitate to ask usage questions, report bugs, suggest features or view the source
code on GitHub under [regionmask/regionmask](https://github.com/regionmask/regionmask).
## License
regionmask is published under a MIT license.