regionmask
create masks of geospatial regions for arbitrary grids
Decision gist · record as of 2026-08-14
Yes. regionmask is actively maintained, has no known vulnerabilities, installs with low friction, and is licensed permissively. It directly solves a common and specific need in climate and geospatial data workflows. Install it if you work with gridded data and need to aggregate or mask by geographic region.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >= 3.10; rasterio may need system libraries (GDAL) depending on your environment.
- Low friction install with a wheel distribution.
- Active maintenance with recent commits and stable production status; supports current Python versions (3.10–3.13).
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute regionmask with minimal restrictions, making it suitable for both open and proprietary projects.
last release 2024-12-03 (619 days) · last repo commit 2026-08-05 · 261 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 177,263 downloads/mo, #10,216 on PyPI
Alternatives
Verify before relying
import regionmask
import xarray as xr
# Load gridded data
data = xr.open_dataset('climate_data.nc')
# Create a mask for a predefined region
mask = regionmask.defined_regions.countries.mask(data)- Whether predefined regions (countries, landmasks, literature regions) are current and comprehensive enough for typical use cases.
- Performance characteristics when masking very large grids or many overlapping regions.
- Availability and quality of shapefile support for custom region definitions beyond the built-in set.
What it is and what it does
regionmask is a Python package for creating spatial masks that map grid points in geospatial datasets to geographic regions. It solves the common problem in climate science and geospatial analysis of needing to aggregate gridded data (such as climate model output or reanalysis data) by region—countries, continents, or custom areas—by determining which region each grid point belongs to. The package generates masks in multiple formats (2D integer, 3D boolean, or 3D fractional) and handles edge cases like region boundaries and overlaps carefully.
The package includes a library of predefined regions (countries, landmasks, and regions from scientific literature) and can also work with user-defined regions from shapefiles via geopandas, numpy arrays, or shapely geometries. It depends on geopandas, numpy, xarray, rasterio, shapely, pooch, and packaging to handle data I/O, spatial operations, and grid manipulation. It is actively maintained, supports modern Python versions, and carries no known security vulnerabilities.
Use it for
- Compute regional climate averages from global model output by masking grid points to countries or continents.
- Aggregate reanalysis data over custom geographic regions defined in scientific literature.
- Generate land-sea masks or other binary spatial masks for filtering gridded datasets.
- Create visualizations of predefined or custom regions overlaid on geospatial grids.
- Build workflows that combine multiple region definitions (overlapping or non-overlapping) for multi-scale analysis.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
regionmask is actively maintained, has no known vulnerabilities, installs with low friction, and is licensed permissively. It directly solves a common and specific need in climate and geospatial data workflows. Install it if you work with gridded data and need to aggregate or mask by geographic region.
Install
regionmask on PyPI
Before you install
Low friction install with a wheel distribution. Active maintenance with recent commits and stable production status; supports current Python versions (3.10–3.13).
Requires Python >= 3.10; rasterio may need system libraries (GDAL) depending on your environment.
License in practice
MIT license is permissive; you can use, modify, and distribute regionmask with minimal restrictions, making it suitable for both open and proprietary projects.
Quickstart
import regionmask
import xarray as xr
# Load gridded data
data = xr.open_dataset('climate_data.nc')
# Create a mask for a predefined region
mask = regionmask.defined_regions.countries.mask(data)
Verify before relying
- Whether predefined regions (countries, landmasks, literature regions) are current and comprehensive enough for typical use cases.
- Performance characteristics when masking very large grids or many overlapping regions.
- Availability and quality of shapefile support for custom region definitions beyond the built-in set.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 7 packagesgeopandasnumpypackagingpoochrasterioshapelyxarray |
| Maintenance | Actively maintained 619 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 177,263 / month, #10,216 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Atmospheric ScienceTopic :: Scientific/Engineering :: GIS |
Evidence: regionmask-0.13.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “geospatial region masks”
- regionmaskregionmask creates spatial masks for gridded data that identify which…
- regionsRegions provides tools for defining, manipulating, and analyzing…
- geocifGenerates climatic impact drivers from Earth observation data and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also geocif · GridDataFormats · regions · pystac-ext-grid · spopt · aws-cdk.region-info · morecantile · dask-geopandas · inequality · drain3