commit:     f231076548125ab4780412b9c58514b251b79fcb
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jul  3 11:12:50 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jul  3 16:06:38 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2310765

dev-python/xarray: Backport pandas & dask compatibility fixes

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../xarray/files/xarray-0.18.2-backports.patch     | 116 +++++++++++++++++++++
 ...array-0.18.2.ebuild => xarray-0.18.2-r1.ebuild} |   4 +
 2 files changed, 120 insertions(+)

diff --git a/dev-python/xarray/files/xarray-0.18.2-backports.patch 
b/dev-python/xarray/files/xarray-0.18.2-backports.patch
new file mode 100644
index 00000000000..be30702e67f
--- /dev/null
+++ b/dev-python/xarray/files/xarray-0.18.2-backports.patch
@@ -0,0 +1,116 @@
+From ca72d56c213a1c47e54b12ee559f412e60fbf9b1 Mon Sep 17 00:00:00 2001
+From: Spencer Clark <[email protected]>
+Date: Sat, 22 May 2021 20:13:19 -0400
+Subject: [PATCH] Make `kind` argument in `CFTimeIndex._maybe_cast_slice_bound`
+ optional (#5359)
+
+* [test-upstream] Make kind argument in CFTimeIndex._maybe_cast_slice_bound 
optional
+
+* Update doc/whats-new.rst
+
+Co-authored-by: keewis <[email protected]>
+
+Co-authored-by: keewis <[email protected]>
+---
+ doc/whats-new.rst            | 4 ++++
+ xarray/coding/cftimeindex.py | 9 +++++++--
+ 2 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/xarray/coding/cftimeindex.py b/xarray/coding/cftimeindex.py
+index f0de5565..783fe8d0 100644
+--- a/xarray/coding/cftimeindex.py
++++ b/xarray/coding/cftimeindex.py
+@@ -465,9 +465,14 @@ class CFTimeIndex(pd.Index):
+         else:
+             return pd.Index.get_loc(self, key, method=method, 
tolerance=tolerance)
+ 
+-    def _maybe_cast_slice_bound(self, label, side, kind):
++    def _maybe_cast_slice_bound(self, label, side, kind=None):
+         """Adapted from
+-        pandas.tseries.index.DatetimeIndex._maybe_cast_slice_bound"""
++        pandas.tseries.index.DatetimeIndex._maybe_cast_slice_bound
++
++        Note that we have never used the kind argument in CFTimeIndex and it 
is
++        deprecated as of pandas version 1.3.0.  It exists only for 
compatibility
++        reasons.  We can remove it when our minimum version of pandas is 
1.3.0.
++        """
+         if not isinstance(label, str):
+             return label
+ 
+-- 
+2.32.0
+
+From 34dc57717c82a86455a9e5abb0a47df782266c7e Mon Sep 17 00:00:00 2001
+From: Mathias Hauser <[email protected]>
+Date: Mon, 7 Jun 2021 23:05:24 +0200
+Subject: [PATCH] fix dask meta and output_dtypes error (#5449)
+
+---
+ xarray/tests/test_computation.py | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/xarray/tests/test_computation.py 
b/xarray/tests/test_computation.py
+index b7ae1ca9..09bed724 100644
+--- a/xarray/tests/test_computation.py
++++ b/xarray/tests/test_computation.py
+@@ -1306,7 +1306,10 @@ def 
test_vectorize_dask_dtype_without_output_dtypes(data_array):
+     assert expected.dtype == actual.dtype
+ 
+ 
[email protected](LooseVersion(dask.__version__) < "2.3", reason="dask 
GH5274")
[email protected](
++    LooseVersion(dask.__version__) > "2021.06",
++    reason="dask/dask#7669: can no longer pass output_dtypes and meta",
++)
+ @requires_dask
+ def test_vectorize_dask_dtype_meta():
+     # meta dtype takes precedence
+-- 
+2.32.0
+
+From 5a14d7d398be7e0efc6d5c8920dc8886212c3b2a Mon Sep 17 00:00:00 2001
+From: Spencer Clark <[email protected]>
+Date: Sat, 12 Jun 2021 08:58:42 -0400
+Subject: [PATCH] Explicitly state datetime units in array constructors in
+ `test_datetime_mean` (#5463)
+
+---
+ xarray/tests/test_duck_array_ops.py | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/xarray/tests/test_duck_array_ops.py 
b/xarray/tests/test_duck_array_ops.py
+index 0eb00725..6d49e209 100644
+--- a/xarray/tests/test_duck_array_ops.py
++++ b/xarray/tests/test_duck_array_ops.py
+@@ -285,15 +285,15 @@ def assert_dask_array(da, dask):
+ def test_datetime_mean(dask):
+     # Note: only testing numpy, as dask is broken upstream
+     da = DataArray(
+-        np.array(["2010-01-01", "NaT", "2010-01-03", "NaT", "NaT"], 
dtype="M8"),
++        np.array(["2010-01-01", "NaT", "2010-01-03", "NaT", "NaT"], 
dtype="M8[ns]"),
+         dims=["time"],
+     )
+     if dask:
+         # Trigger use case where a chunk is full of NaT
+         da = da.chunk({"time": 3})
+ 
+-    expect = DataArray(np.array("2010-01-02", dtype="M8"))
+-    expect_nat = DataArray(np.array("NaT", dtype="M8"))
++    expect = DataArray(np.array("2010-01-02", dtype="M8[ns]"))
++    expect_nat = DataArray(np.array("NaT", dtype="M8[ns]"))
+ 
+     actual = da.mean()
+     if dask:
+@@ -889,8 +889,6 @@ def test_push_dask():
+     # some chunks of size-1 with NaN
+     with raise_if_dask_computes():
+         actual = push(
+-            dask.array.from_array(array, chunks=(1, 2, 3, 2, 2, 1, 1)),
+-            axis=0,
+-            n=None,
++            dask.array.from_array(array, chunks=(1, 2, 3, 2, 2, 1, 1)), 
axis=0, n=None
+         )
+     np.testing.assert_equal(actual, expected)
+-- 
+2.32.0
+

diff --git a/dev-python/xarray/xarray-0.18.2.ebuild 
b/dev-python/xarray/xarray-0.18.2-r1.ebuild
similarity index 95%
rename from dev-python/xarray/xarray-0.18.2.ebuild
rename to dev-python/xarray/xarray-0.18.2-r1.ebuild
index bedc8b3da11..573e03b4e44 100644
--- a/dev-python/xarray/xarray-0.18.2.ebuild
+++ b/dev-python/xarray/xarray-0.18.2-r1.ebuild
@@ -32,6 +32,10 @@ BDEPEND="
 
 distutils_enable_tests pytest
 
+PATCHES=(
+       "${FILESDIR}"/${P}-backports.patch
+)
+
 python_test() {
        local deselect=(
                # warning-targeted tests are fragile and not important to end 
users

Reply via email to