Note

This tutorial was generated from an IPython notebook that can be downloaded here.

Create your own region

Creating own regions is straightforward.

Import regionmask and check the version:

/home/docs/checkouts/readthedocs.org/user_builds/regionmask/conda/v0.2.0/lib/python2.7/site-packages/matplotlib/__init__.py:1357: UserWarning:  This call to matplotlib.use() has no effect
because the backend has already been chosen;
matplotlib.use() must be called before pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

  warnings.warn(_use_error_msg)
'0.2.0'

Assume you have two custom regions in the US.

You also need to provide numbers, names and abbreviations:

Again we can plot the outline of the defined regions

../../_images/create_own_regions_9_0.png

and obtain a mask:

../../_images/create_own_regions_12_0.png

Use shapely Polygon

If you have the region defined as a shapely polygon, this also works: