From 5533a6754226d367f73e84e4cd94d50265173db7 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Wed, 19 May 2021 14:15:13 -0700 Subject: [PATCH 1/6] Revert "Use _unstack_once for valid dask and sparse versions (#5315)" This reverts commit 9165c266f52830384c399f0607a4123e65bb7803. --- xarray/core/dataset.py | 46 ++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index a42d045705c..f59b9b6bea5 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -78,7 +78,7 @@ ) from .missing import get_clean_interp_index from .options import OPTIONS, _get_keep_attrs -from .pycompat import dask_version, is_duck_dask_array +from .pycompat import is_duck_dask_array, sparse_array_type from .utils import ( Default, Frozen, @@ -4028,24 +4028,36 @@ def unstack( result = self.copy(deep=False) for dim in dims: - if not sparse and all( - # Dask arrays recently supports assignment by index, - # https://github.com/dask/dask/pull/7393 - dask_version >= "2021.04.0" and is_duck_dask_array(v.data) - # Numpy arrays handles the fast path: - or isinstance(v.data, np.ndarray) - for v in self.variables.values() + + if ( + # Dask arrays don't support assignment by index, which the fast unstack + # function requires. + # https://github.com/pydata/xarray/pull/4746#issuecomment-753282125 + any(is_duck_dask_array(v.data) for v in self.variables.values()) + # Sparse doesn't currently support (though we could special-case + # it) + # https://github.com/pydata/sparse/issues/422 + or any( + isinstance(v.data, sparse_array_type) + for v in self.variables.values() + ) + or sparse + # Until https://github.com/pydata/xarray/pull/4751 is resolved, + # we check explicitly whether it's a numpy array. Once that is + # resolved, explicitly exclude pint arrays. + # # pint doesn't implement `np.full_like` in a way that's + # # currently compatible. + # # https://github.com/pydata/xarray/pull/4746#issuecomment-753425173 + # # or any( + # # isinstance(v.data, pint_array_type) for v in self.variables.values() + # # ) + or any( + not isinstance(v.data, np.ndarray) for v in self.variables.values() + ) ): - # Fast unstacking path: - result = result._unstack_once(dim, fill_value) - else: - # Slower unstacking path, examples of array types that - # currently has to use this path: - # * sparse doesn't support item assigment, - # https://github.com/pydata/sparse/issues/114 - # * pint has some circular import issues, - # https://github.com/pydata/xarray/pull/4751 result = result._unstack_full_reindex(dim, fill_value, sparse) + else: + result = result._unstack_once(dim, fill_value) return result def update(self, other: "CoercibleMapping") -> "Dataset": From 1b4412eeb7011f53932779e1d7c3534163aedd63 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Wed, 19 May 2021 14:18:49 -0700 Subject: [PATCH 2/6] 0.18.2 release notes --- doc/whats-new.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 5c0a4d11f53..4b60efe8bb8 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -14,6 +14,13 @@ What's New np.random.seed(123456) +.. _whats-new.0.18.2: + +v0.18.2 (19 May 2021) +--------------------- + +This release reverts a regression in xarray's unstacking of dask-backed arrays. + .. _whats-new.0.18.1: v0.18.1 (18 May 2021) From 0e52f9f3082fe9fc32e6eb08ef35f4e3583a1ad0 Mon Sep 17 00:00:00 2001 From: keewis Date: Wed, 23 Jun 2021 19:14:12 +0200 Subject: [PATCH 3/6] fix RTD [skip-ci] (#5518) --- doc/whats-new.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 4b60efe8bb8..d28b821d958 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -643,7 +643,7 @@ Documentation By `Pieter Gijsbers `_. - Fix grammar and typos in the :doc:`contributing` guide (:pull:`4545`). By `Sahid Velji `_. -- Fix grammar and typos in the :doc:`io` guide (:pull:`4553`). +- Fix grammar and typos in the :doc:`user-guide/io` guide (:pull:`4553`). By `Sahid Velji `_. - Update link to NumPy docstring standard in the :doc:`contributing` guide (:pull:`4558`). By `Sahid Velji `_. @@ -2952,7 +2952,7 @@ Documentation - Added apply_ufunc example to :ref:`/examples/weather-data.ipynb#Toy-weather-data` (:issue:`1844`). By `Liam Brannigan `_. - New entry `Why don’t aggregations return Python scalars?` in the - :doc:`faq` (:issue:`1726`). + :doc:`getting-started-guide/faq` (:issue:`1726`). By `0x0L `_. Enhancements From 496ce81dbe0aca60c575ecc2757807580d35a5a4 Mon Sep 17 00:00:00 2001 From: Thomas Nicholas Date: Fri, 23 Jul 2021 16:36:47 -0400 Subject: [PATCH 4/6] v0.19.0 release notes --- doc/whats-new.rst | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 6127edcfc87..30a72de31c6 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -14,11 +14,24 @@ What's New np.random.seed(123456) -.. _whats-new.0.18.3: -v0.18.3 (unreleased) +.. _whats-new.0.19.0: + +v0.19.0 (23 July 2021) --------------------- +This release brings improvements to plotting of categorical data, the ability to specify how attributes +are combined in xarray operations, a new high-level :py:func:`unify_chunks` function, as well as various +deprecations, bug fixes, and minor improvements. + + +Many thanks to the 29 contributors to this release!: + +Andrew Williams, Augustus, Aureliana Barghini, Benoit Bovy, crusaderky, Deepak Cherian, ellesmith88, +Elliott Sales de Andrade, Giacomo Caria, github-actions[bot], Illviljan, Joeperdefloep, joooeey, Julia Kent, +Julius Busecke, keewis, Mathias Hauser, Matthias Göbel, Mattia Almansi, Maximilian Roos, Peter Andreas Entschev, +Ray Bell, Sander, Santiago Soler, Sebastian, Spencer Clark, Stephan Hoyer, Thomas Hirtz, Thomas Nicholas. + New Features ~~~~~~~~~~~~ - Allow passing argument ``missing_dims`` to :py:meth:`Variable.transpose` and :py:meth:`Dataset.transpose` @@ -117,7 +130,6 @@ Internal Changes - Publish test results & timings on each PR. (:pull:`5537`) By `Maximilian Roos `_. - - Explicit indexes refactor: add a ``xarray.Index.query()`` method in which one may eventually provide a custom implementation of label-based data selection (not ready yet for public use). Also refactor the internal, From 6ea80719bd969829c48c9276d5bb0d012fcbb91f Mon Sep 17 00:00:00 2001 From: keewis Date: Fri, 23 Jul 2021 22:56:21 +0200 Subject: [PATCH 5/6] Update doc/whats-new.rst [skip-ci] --- doc/whats-new.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 30a72de31c6..c63ec78cc6c 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -18,7 +18,7 @@ What's New .. _whats-new.0.19.0: v0.19.0 (23 July 2021) ---------------------- +---------------------- This release brings improvements to plotting of categorical data, the ability to specify how attributes are combined in xarray operations, a new high-level :py:func:`unify_chunks` function, as well as various From 975834931a8a2ecc6045f8c1d93f79aa0fbb864f Mon Sep 17 00:00:00 2001 From: Thomas Nicholas Date: Fri, 23 Jul 2021 17:11:10 -0400 Subject: [PATCH 6/6] remove empty sections --- doc/whats-new.rst | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 30a72de31c6..7aa7638e19e 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -118,10 +118,6 @@ Bug fixes By `Augustus Ijams `_. -Documentation -~~~~~~~~~~~~~ - - Internal Changes ~~~~~~~~~~~~~~~~ - Run CI on the first & last python versions supported only; currently 3.7 & 3.9. @@ -174,13 +170,6 @@ New Features - Raise more informative error when decoding time variables with invalid reference dates. (:issue:`5199`, :pull:`5288`). By `Giacomo Caria `_. -Breaking changes -~~~~~~~~~~~~~~~~ - - -Deprecations -~~~~~~~~~~~~ - Bug fixes ~~~~~~~~~