grids can now be masked correctly. Further, :py:class:`Regions` can now be round-tripped
to :py:class:`geopandas.GeoDataFrame` objects. The new version also adds PRUDENCE
regions and a more stable handling of naturalearth regions.
Many thanks to the contributors to the v0.9.0 release: Aaron Spring, Mathias Hauser, and
Ruth Lorenz!
Breaking Changes
~~~~~~~~~~~~~~~~
- Removed support for Python 3.6 (:pull:`288`).
- The ``xarray.DataArray`` mask returned by all masking functions (e.g. :py:meth:`Regions.mask`)
was renamed from `region` to `mask`. The former was ambiguous with respect to the `region` dimension
of 3D masks (:pull:`318`).
- The minimum versions of some dependencies were changed (:pull:`311`, :pull:`312`):
============ ===== =====
Package Old New
============ ===== =====
geopandas 0.6 0.7
matplotlib 3.1 3.2
pooch 1.0 1.2
rasterio 1.0 1.1
shapely 1.6 1.7
============ ===== =====
- ``regionmask.defined_regions.natural_earth`` is deprecated. ``defined_regions.natural_earth`` used
cartopy to download natural_earth data and it was unclear which version of the regions
is available. This is problematic because some regions change between the versions.
Please use ``defined_regions.natural_earth_v4_1_0`` or ``defined_regions.natural_earth_v5_0_0``
instead (:issue:`306`, :pull:`311`).
- Passing coordinates with different type to :py:meth:`Regions.mask` and :py:meth:`Regions.mask_3D`
is no longer supported, i.e. can no longer pass lon as numpy array and lat as
DataArray (:pull:`294`).
- The mask no longer has dimension coordinates when 2D numpy arrays are passed as lat and
lon coords (:pull:`294`).
Enhancements
~~~~~~~~~~~~
- regionmask does now correctly treat overlapping regions if ``overlap=True`` is set in
the constructor (:issue:`228`, :pull:`318`).
Per default regionmask assumes non-overlapping regions. In this case grid points of
overlapping polygons will silently be assigned to the region with the higher number.
This may change in a future version.
- :py:meth:`Regions.mask` and :py:meth:`Regions.mask_3D` now work with unstructured 1D
grids such as:
- `ICON <https://code.mpimet.mpg.de/projects/iconpublic>`_
- `FESOM <https://fesom.de/>`_
- `MPAS <https://mpas-dev.github.io/>`_
with 1-dimensional coordinates of the form ``lon(cell)`` and ``lat(cell)``.
Note that only xarray arrays can be detected as unstructured grids.
(:issue:`278`, :pull:`280`). By `Aaron Spring <https://github.com/aaronspring>`_.
- Add methods to convert :py:class:`Regions` to (geo)pandas objects, namely :py:meth:`Regions.to_geodataframe`,
:py:meth:`Regions.to_geoseries`, :py:meth:`Regions.to_dataframe`). The geopandas.GeoDataFrame
can be converted back (round-tripped) using :py:meth:`Regions.from_geodataframe`
(:issue:`50`, :pull:`298`).
- The plotting methods (:py:meth:`Regions.plot` and :py:meth:`Regions.plot_regions`) now
use a more sophisticated logic to subsample lines on GeoAxes plots. The new method is
based on the euclidean distance of each segment. Per default the maximum distance of
each segment is 1 for lat/ lon coords - see the ``tolerance`` keyword of the plotting
methods. The ``subsample`` keyword is deprecated (:issue:`109`, :pull:`292`).
- The download of the natural_earth regions is now done in regionmask (using pooch) and no
longer relies on cartopy (:issue:`306`, :pull:`311`).
Deprecations
~~~~~~~~~~~~
- The ``regionmask.defined_regions._ar6_pre_revisions`` regions are deprecated. The
``regionmask.defined_regions.ar6`` regions should be used instead (:issue:`314`, :pull:`320`).
New regions
~~~~~~~~~~~
- Added :py:attr:`prudence` regions for Europe from `Christensen and Christensen, 2007,
<https://link.springer.com/article/10.1007/s10584-006-9210-7>`_ (:pull:`283`).
By `Ruth Lorenz <https://github.com/ruthlorenz>`_.
Bug Fixes
~~~~~~~~~
- The name of lon and lat coordinates when passed as single elements is now respected when
creating masks i.e. for ``region.mask(ds.longitude, ds.longitude)`` (:issue:`129`,
:pull:`294`).
- Ensure :py:meth:`Regions.plot` uses the current axes (``plt.gca()``) if possible and
error if a non-cartopy GeoAxes is passed (:issue:`316`, :pull:`321`).
Docs
~~~~
- Went over the documentation, improved some sections, unpinned some packages, modernized
some aspects (:pull:`313`).
Internal Changes
~~~~~~~~~~~~~~~~
- Fix compatibility with shapely 1.8 (:pull:`291`).
- Fix downloading naturalearth regions part 2 (see :pull:`261`): Monkeypatch the correct
download URL and catch all ``URLError``, not only timeouts (:pull:`289`).
- Rewrote the function to create the mask `DataArray` (:issue:`168`, :pull:`294`).
- Follow up to :pull:`294` - fix wrong dimension order for certain conditions (:issue:`295`).
- Refactor `test_mask` - make use of ``xr.testing.assert_equal`` and simplify some
elements (:pull:`297`).
- Add `packaging` as a dependency (:issue:`324`, :pull:`328`).
- Add python 3.10 to list of supported versions (:pull:`330`).
.. _whats-new.0.8.0: