Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66c2059622 |
@@ -1,7 +1,7 @@
|
||||
From e84321150e52a19e617efd7f8798d6859bd3c5e7 Mon Sep 17 00:00:00 2001
|
||||
From 33ab61521498550eda98d7aebc141635f9f218d7 Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Sun, 19 Jan 2025 04:47:23 -0500
|
||||
Subject: [PATCH 2/2] Avoid unsafe casts from float to unsigned int
|
||||
Subject: [PATCH] Avoid unsafe casts from float to unsigned int
|
||||
|
||||
Fixes #9815
|
||||
|
||||
@@ -12,7 +12,7 @@ Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
2 files changed, 14 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/xarray/coding/variables.py b/xarray/coding/variables.py
|
||||
index 8154f044..355f3b0b 100644
|
||||
index 83112628..b036fd5d 100644
|
||||
--- a/xarray/coding/variables.py
|
||||
+++ b/xarray/coding/variables.py
|
||||
@@ -426,7 +426,10 @@ class CFMaskCoder(VariableCoder):
|
||||
@@ -28,7 +28,7 @@ index 8154f044..355f3b0b 100644
|
||||
|
||||
return Variable(dims, data, attrs, encoding, fastpath=True)
|
||||
diff --git a/xarray/core/duck_array_ops.py b/xarray/core/duck_array_ops.py
|
||||
index 7e7333fd..be842b66 100644
|
||||
index c3f15980..1cec78cb 100644
|
||||
--- a/xarray/core/duck_array_ops.py
|
||||
+++ b/xarray/core/duck_array_ops.py
|
||||
@@ -236,6 +236,16 @@ def astype(data, dtype, **kwargs):
|
||||
@@ -49,5 +49,5 @@ index 7e7333fd..be842b66 100644
|
||||
converted = data if is_duck_array(data) else xp.asarray(data)
|
||||
|
||||
--
|
||||
2.47.0
|
||||
2.49.0
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
From f41100ae4202dce5891854143ba3a31f4e2d5a6d Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Tue, 14 Jan 2025 02:46:39 -0500
|
||||
Subject: [PATCH 1/2] Fix test_doc_example on big-endian systems
|
||||
|
||||
... by using a fixed-endian input.
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
xarray/tests/test_datatree.py | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/xarray/tests/test_datatree.py b/xarray/tests/test_datatree.py
|
||||
index 7b295128..21870050 100644
|
||||
--- a/xarray/tests/test_datatree.py
|
||||
+++ b/xarray/tests/test_datatree.py
|
||||
@@ -1240,8 +1240,12 @@ class TestRepr:
|
||||
)
|
||||
def test_doc_example(self) -> None:
|
||||
# regression test for https://github.com/pydata/xarray/issues/9499
|
||||
- time = xr.DataArray(data=["2022-01", "2023-01"], dims="time")
|
||||
- stations = xr.DataArray(data=list("abcdef"), dims="station")
|
||||
+ time = xr.DataArray(
|
||||
+ data=np.array(["2022-01", "2023-01"], dtype="<U7"), dims="time"
|
||||
+ )
|
||||
+ stations = xr.DataArray(
|
||||
+ data=np.array(list("abcdef"), dtype="<U1"), dims="station"
|
||||
+ )
|
||||
lon = [-100, -80, -60]
|
||||
lat = [10, 20, 30]
|
||||
# Set up fake data
|
||||
--
|
||||
2.47.0
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
--- xarray-2025.1.1/xarray/tests/test_dask.py.orig 2025-05-21 09:34:50.648289221 -0400
|
||||
+++ xarray-2025.1.1/xarray/tests/test_dask.py 2025-05-21 09:37:04.903633951 -0400
|
||||
@@ -1042,6 +1042,8 @@
|
||||
ds.foo.variable.compute()
|
||||
|
||||
|
||||
+@pytest.mark.flaky
|
||||
+@pytest.mark.skip(reason="maybe flaky epel10")
|
||||
def test_dask_layers_and_dependencies():
|
||||
ds = Dataset({"foo": ("x", range(5)), "bar": ("x", range(5))}).chunk()
|
||||
|
||||
--- xarray-2025.1.1/xarray/tests/test_datatree_mapping.py.orig 2025-05-21 09:37:35.179529595 -0400
|
||||
+++ xarray-2025.1.1/xarray/tests/test_datatree_mapping.py 2025-05-21 09:38:39.269279900 -0400
|
||||
@@ -157,6 +157,8 @@
|
||||
result = dt.map_over_datasets(empty_func)
|
||||
assert result["set1/set2"].attrs == dt["set1/set2"].attrs
|
||||
|
||||
+ @pytest.mark.flaky
|
||||
+ @pytest.mark.skip(reason="maybe flaky epel10")
|
||||
def test_error_contains_path_of_offending_node(self, create_test_datatree):
|
||||
dt = create_test_datatree()
|
||||
dt["set1"]["bad_var"] = 0
|
||||
--- xarray-2025.1.1/xarray/tests/test_backends.py.orig 2025-05-21 10:05:24.190411283 -0400
|
||||
+++ xarray-2025.1.1/xarray/tests/test_backends.py 2025-05-21 10:07:26.667130437 -0400
|
||||
@@ -5677,9 +5677,8 @@
|
||||
|
||||
@requires_scipy_or_netCDF4
|
||||
@pytest.mark.parametrize("calendar", _STANDARD_CALENDARS)
|
||||
-@pytest.mark.xfail(
|
||||
- has_numpy_2, reason="https://github.com/pandas-dev/pandas/issues/56996"
|
||||
-)
|
||||
+@pytest.mark.flaky
|
||||
+@pytest.mark.skip(reason="maybe flaky epel10")
|
||||
def test_use_cftime_false_standard_calendar_in_range(calendar) -> None:
|
||||
x = [0, 1]
|
||||
time = [0, 720]
|
||||
102
9945.patch
102
9945.patch
@@ -1,102 +0,0 @@
|
||||
From da4aa1f2f116089c75adee5954bcc9ab755bcb89 Mon Sep 17 00:00:00 2001
|
||||
From: Deepak Cherian <deepak@cherian.net>
|
||||
Date: Mon, 13 Jan 2025 08:00:50 -0600
|
||||
Subject: [PATCH 1/2] Remove outdated quantile test.
|
||||
|
||||
dask now auto-rechunks for quantile.
|
||||
|
||||
Closes #9860
|
||||
---
|
||||
xarray/tests/test_groupby.py | 18 ++++++++++--------
|
||||
1 file changed, 10 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/xarray/tests/test_groupby.py b/xarray/tests/test_groupby.py
|
||||
index e4383dd58a9..2349ff0adfd 100644
|
||||
--- a/xarray/tests/test_groupby.py
|
||||
+++ b/xarray/tests/test_groupby.py
|
||||
@@ -284,7 +284,6 @@ def test_da_groupby_empty() -> None:
|
||||
|
||||
@requires_dask
|
||||
def test_dask_da_groupby_quantile() -> None:
|
||||
- # Only works when the grouped reduction can run blockwise
|
||||
# Scalar quantile
|
||||
expected = xr.DataArray(
|
||||
data=[2, 5], coords={"x": [1, 2], "quantile": 0.5}, dims="x"
|
||||
@@ -292,8 +291,6 @@ def test_dask_da_groupby_quantile() -> None:
|
||||
array = xr.DataArray(
|
||||
data=[1, 2, 3, 4, 5, 6], coords={"x": [1, 1, 1, 2, 2, 2]}, dims="x"
|
||||
)
|
||||
- with pytest.raises(ValueError):
|
||||
- array.chunk(x=1).groupby("x").quantile(0.5)
|
||||
|
||||
# will work blockwise with flox
|
||||
actual = array.chunk(x=3).groupby("x").quantile(0.5)
|
||||
@@ -327,7 +324,8 @@ def test_dask_da_groupby_median() -> None:
|
||||
assert_identical(expected, actual)
|
||||
|
||||
|
||||
-def test_da_groupby_quantile() -> None:
|
||||
+@pytest.mark.parametrize("use_flox", [True, False])
|
||||
+def test_da_groupby_quantile(use_flox) -> None:
|
||||
array = xr.DataArray(
|
||||
data=[1, 2, 3, 4, 5, 6], coords={"x": [1, 1, 1, 2, 2, 2]}, dims="x"
|
||||
)
|
||||
@@ -336,8 +334,10 @@ def test_da_groupby_quantile() -> None:
|
||||
expected = xr.DataArray(
|
||||
data=[2, 5], coords={"x": [1, 2], "quantile": 0.5}, dims="x"
|
||||
)
|
||||
- actual = array.groupby("x").quantile(0.5)
|
||||
- assert_identical(expected, actual)
|
||||
+
|
||||
+ with xr.set_options(use_flox=use_flox):
|
||||
+ actual = array.groupby("x").quantile(0.5)
|
||||
+ assert_identical(expected, actual)
|
||||
|
||||
# Vector quantile
|
||||
expected = xr.DataArray(
|
||||
@@ -345,7 +345,8 @@ def test_da_groupby_quantile() -> None:
|
||||
coords={"x": [1, 2], "quantile": [0, 1]},
|
||||
dims=("x", "quantile"),
|
||||
)
|
||||
- actual = array.groupby("x").quantile([0, 1])
|
||||
+ with xr.set_options(use_flox=use_flox):
|
||||
+ actual = array.groupby("x").quantile([0, 1])
|
||||
assert_identical(expected, actual)
|
||||
|
||||
array = xr.DataArray(
|
||||
@@ -356,7 +357,8 @@ def test_da_groupby_quantile() -> None:
|
||||
e = [np.nan, 5] if skipna is False else [2.5, 5]
|
||||
|
||||
expected = xr.DataArray(data=e, coords={"x": [1, 2], "quantile": 0.5}, dims="x")
|
||||
- actual = array.groupby("x").quantile(0.5, skipna=skipna)
|
||||
+ with xr.set_options(use_flox=use_flox):
|
||||
+ actual = array.groupby("x").quantile(0.5, skipna=skipna)
|
||||
assert_identical(expected, actual)
|
||||
|
||||
# Multiple dimensions
|
||||
|
||||
From 3d6e76a29a328489b0867a89fce1c157605c5f5d Mon Sep 17 00:00:00 2001
|
||||
From: Deepak Cherian <dcherian@users.noreply.github.com>
|
||||
Date: Mon, 13 Jan 2025 10:28:29 -0600
|
||||
Subject: [PATCH 2/2] Apply suggestions from code review
|
||||
|
||||
Co-authored-by: Michael Niklas <mick.niklas@gmail.com>
|
||||
---
|
||||
xarray/tests/test_groupby.py | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/xarray/tests/test_groupby.py b/xarray/tests/test_groupby.py
|
||||
index 2349ff0adfd..7dd6cdb622d 100644
|
||||
--- a/xarray/tests/test_groupby.py
|
||||
+++ b/xarray/tests/test_groupby.py
|
||||
@@ -324,8 +324,8 @@ def test_dask_da_groupby_median() -> None:
|
||||
assert_identical(expected, actual)
|
||||
|
||||
|
||||
-@pytest.mark.parametrize("use_flox", [True, False])
|
||||
-def test_da_groupby_quantile(use_flox) -> None:
|
||||
+@pytest.mark.parametrize("use_flox", [pytest.param(True, marks=requires_flox), False])
|
||||
+def test_da_groupby_quantile(use_flox: bool) -> None:
|
||||
array = xr.DataArray(
|
||||
data=[1, 2, 3, 4, 5, 6], coords={"x": [1, 1, 1, 2, 2, 2]}, dims="x"
|
||||
)
|
||||
@@ -1,7 +1,7 @@
|
||||
%global srcname xarray
|
||||
|
||||
Name: python-%{srcname}
|
||||
Version: 2025.1.1
|
||||
Version: 2025.1.2
|
||||
Release: %autorelease
|
||||
Summary: N-D labeled arrays and datasets in Python
|
||||
|
||||
@@ -9,14 +9,8 @@ License: Apache-2.0
|
||||
URL: https://github.com/pydata/xarray
|
||||
Source: %pypi_source %{srcname}
|
||||
|
||||
# Fix test_dask_da_groupby_quantile.
|
||||
Patch: https://github.com/pydata/xarray/pull/9945.patch
|
||||
|
||||
# https://github.com/pydata/xarray/pull/9949
|
||||
Patch: 0001-Fix-test_doc_example-on-big-endian-systems.patch
|
||||
# https://github.com/pydata/xarray/pull/9964
|
||||
Patch: 0002-Avoid-unsafe-casts-from-float-to-unsigned-int.patch
|
||||
Patch: 0003-tests-epel10.patch
|
||||
Patch: 0001-Avoid-unsafe-casts-from-float-to-unsigned-int.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
|
||||
Reference in New Issue
Block a user