forked from pool/python-xarray
Accepting request 906784 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/906784 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-xarray?expand=0&rev=28
This commit is contained in:
commit
c4f8789442
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 16 16:01:56 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Add xarray-pr5449-dask-meta.patch in order to support updated
|
||||
dask -- gh#pydata/xarray#5449
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue May 25 17:25:46 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#
|
||||
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
%{?!python_module:%define python_module() python3-%{**}}
|
||||
%define skip_python2 1
|
||||
# NEP 29: Numpy 1.20 dropped support for Python 3.6, python36-numpy is removed from Tumbleweed. xarray will follow on next release
|
||||
%define skip_python36 1
|
||||
@ -36,6 +36,8 @@ Patch1: scipy-interpolate.patch
|
||||
# PATCH-FIX-UPSTREAM test_resample_loffset.patch gh#pydata/xarray#5364 mcepl@suse.com
|
||||
# use assert_allclose in test_resample_loffset test
|
||||
Patch2: test_resample_loffset.patch
|
||||
# PATCH-FIX-UPSTREAM xarray-pr5449-dask-meta.patch -- gh#pydata/xarray#5449
|
||||
Patch3: https://github.com/pydata/xarray/pull/5449.patch#/xarray-pr5449-dask-meta.patch
|
||||
BuildRequires: %{python_module numpy >= 1.15}
|
||||
BuildRequires: %{python_module numpy-devel >= 1.14}
|
||||
BuildRequires: %{python_module pandas >= 0.25}
|
||||
|
115
xarray-pr5449-dask-meta.patch
Normal file
115
xarray-pr5449-dask-meta.patch
Normal file
@ -0,0 +1,115 @@
|
||||
From 941b8a8286178c13ee057d87a5198f163c174b0e Mon Sep 17 00:00:00 2001
|
||||
From: Mathias Hauser <mathias.hauser@env.ethz.ch>
|
||||
Date: Mon, 7 Jun 2021 20:21:00 +0200
|
||||
Subject: [PATCH 1/3] fix dask meta and output_dtypes error
|
||||
|
||||
---
|
||||
xarray/tests/test_computation.py | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/xarray/tests/test_computation.py b/xarray/tests/test_computation.py
|
||||
index b7ae1ca982..7759e7d6a8 100644
|
||||
--- a/xarray/tests/test_computation.py
|
||||
+++ b/xarray/tests/test_computation.py
|
||||
@@ -1313,7 +1313,8 @@ def test_vectorize_dask_dtype_meta():
|
||||
data_array = xr.DataArray([[0, 1, 2], [1, 2, 3]], dims=("x", "y"))
|
||||
expected = xr.DataArray([1, 2], dims=["x"])
|
||||
|
||||
- actual = apply_ufunc(
|
||||
+ func = functools.partial(
|
||||
+ apply_ufunc,
|
||||
pandas_median,
|
||||
data_array.chunk({"x": 1}),
|
||||
input_core_dims=[["y"]],
|
||||
@@ -1323,8 +1324,14 @@ def test_vectorize_dask_dtype_meta():
|
||||
dask_gufunc_kwargs=dict(meta=np.ndarray((0, 0), dtype=float)),
|
||||
)
|
||||
|
||||
- assert_identical(expected, actual)
|
||||
- assert float == actual.dtype
|
||||
+ # dask/dask#7669: can no longer pass output_dtypes and meta
|
||||
+ if LooseVersion(dask.__version__) >= "2021.06":
|
||||
+ with pytest.raises(ValueError):
|
||||
+ func()
|
||||
+ else:
|
||||
+ actual = func()
|
||||
+ assert_identical(expected, actual)
|
||||
+ assert float == actual.dtype
|
||||
|
||||
|
||||
def pandas_median_add(x, y):
|
||||
|
||||
From 2e51db563f82657a30a0b3d87f0ddab36a936fe9 Mon Sep 17 00:00:00 2001
|
||||
From: Mathias Hauser <mathias.hauser@env.ethz.ch>
|
||||
Date: Mon, 7 Jun 2021 21:48:15 +0200
|
||||
Subject: [PATCH 2/3] don't test in newer dask versions
|
||||
|
||||
---
|
||||
xarray/tests/test_computation.py | 18 +++++++-----------
|
||||
1 file changed, 7 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/xarray/tests/test_computation.py b/xarray/tests/test_computation.py
|
||||
index 7759e7d6a8..92a543e14b 100644
|
||||
--- a/xarray/tests/test_computation.py
|
||||
+++ b/xarray/tests/test_computation.py
|
||||
@@ -1306,15 +1306,17 @@ def test_vectorize_dask_dtype_without_output_dtypes(data_array):
|
||||
assert expected.dtype == actual.dtype
|
||||
|
||||
|
||||
-@pytest.mark.xfail(LooseVersion(dask.__version__) < "2.3", reason="dask GH5274")
|
||||
+@pytest.mark.skip(
|
||||
+ 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
|
||||
data_array = xr.DataArray([[0, 1, 2], [1, 2, 3]], dims=("x", "y"))
|
||||
expected = xr.DataArray([1, 2], dims=["x"])
|
||||
|
||||
- func = functools.partial(
|
||||
- apply_ufunc,
|
||||
+ actual = apply_ufunc(
|
||||
pandas_median,
|
||||
data_array.chunk({"x": 1}),
|
||||
input_core_dims=[["y"]],
|
||||
@@ -1324,14 +1326,8 @@ def test_vectorize_dask_dtype_meta():
|
||||
dask_gufunc_kwargs=dict(meta=np.ndarray((0, 0), dtype=float)),
|
||||
)
|
||||
|
||||
- # dask/dask#7669: can no longer pass output_dtypes and meta
|
||||
- if LooseVersion(dask.__version__) >= "2021.06":
|
||||
- with pytest.raises(ValueError):
|
||||
- func()
|
||||
- else:
|
||||
- actual = func()
|
||||
- assert_identical(expected, actual)
|
||||
- assert float == actual.dtype
|
||||
+ assert_identical(expected, actual)
|
||||
+ assert float == actual.dtype
|
||||
|
||||
|
||||
def pandas_median_add(x, y):
|
||||
|
||||
From a4cef6dac3fa5a84f144e56c63ce4b3b903681b4 Mon Sep 17 00:00:00 2001
|
||||
From: Mathias Hauser <mathias.hauser@env.ethz.ch>
|
||||
Date: Mon, 7 Jun 2021 21:56:46 +0200
|
||||
Subject: [PATCH 3/3] skipIF
|
||||
|
||||
---
|
||||
xarray/tests/test_computation.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/xarray/tests/test_computation.py b/xarray/tests/test_computation.py
|
||||
index 92a543e14b..09bed72496 100644
|
||||
--- a/xarray/tests/test_computation.py
|
||||
+++ b/xarray/tests/test_computation.py
|
||||
@@ -1306,7 +1306,7 @@ def test_vectorize_dask_dtype_without_output_dtypes(data_array):
|
||||
assert expected.dtype == actual.dtype
|
||||
|
||||
|
||||
-@pytest.mark.skip(
|
||||
+@pytest.mark.skipif(
|
||||
LooseVersion(dask.__version__) > "2021.06",
|
||||
reason="dask/dask#7669: can no longer pass output_dtypes and meta",
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user