Installation

Required dependencies

Optional dependencies

For plotting

  • matplotlib (3.2 or later) is required to create any plots.

  • cartopy (0.17 or later) for plotting on geographical maps.

For parsing flag values

  • cf_xarray (0.6.1 or later) allows rich comparison of mask.cf for 2D masks with the abbreviations or names of the regions.

For faster loading of shapefiles

  • pyogrio (0.3 or later) allows faster reading of shapefiles. Currently only used for natural earth data (as the other data is loaded reasonanbly fast with fiona).

For faster masking

Note

pygeos is being deprecated in favour if the upcoming release of shapely 2.0. As soon as shapely 2.0 is released there is no longer an advantage in installing pygeos.

  • pygeos (0.9 or later) enables faster mask creations for irregular and 2D grids.

Instructions

regionmask itself is a pure Python package, but its dependencies are not. The easiest way to get them installed is to use conda. The package is available on the conda-forge channel.

conda install -c conda-forge regionmask cartopy pygeos

All required dependencies can be installed with pip. You can thus install regionmask directly:

pip install regionmask

Note, however, that the optional dependency cartopy can be very difficult to install with pip.

Testing

To run the test suite after installing regionmask, install pytest and run pytest in the root directory of regionmask.

To install the development version (main), do:

pip install git+https://github.com/regionmask/regionmask