diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a0b272df..95341cb9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Convert setup.py to pyproject.toml ([#920](https://github.com/Open-EO/openeo-python-client/issues/920)) - Make `_DerivedFrom._from_url` more resilient against unresolvable/unparsable `derived_from` links ([#928](https://github.com/Open-EO/openeo-python-client/issues/928), eu-cdse/openeo-cdse-infra#1338) - `download_url()`: favor explicit HEAD status check over unhelpful auto-check ([#939](https://github.com/Open-EO/openeo-python-client/issues/939)) +- Modernize Xarray version support: remove `<2025.0.2` upper limit but require at least `2024.07.0` ([#721](https://github.com/Open-EO/openeo-python-client/issues/721)) ### Removed diff --git a/pyproject.toml b/pyproject.toml index 5b8804105..97ff8d482 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ dependencies = [ "requests>=2.26.0", "shapely>=1.6.4", "urllib3>=1.9.0", - "xarray>=0.12.3,<2025.01.2", # TODO #721 xarray non-nanosecond support + "xarray>=2024.7.0", ] [project.optional-dependencies] diff --git a/tests/testing/test_results.py b/tests/testing/test_results.py index 790efcfa1..c1b737b76 100644 --- a/tests/testing/test_results.py +++ b/tests/testing/test_results.py @@ -374,10 +374,6 @@ def test_assert_xarray_dataset_allclose_tolerance(self, kwargs, assertion_error) with raises_assertion_error_or_not(message=assertion_error): assert_xarray_dataset_allclose(actual=actual, expected=expected, **kwargs) - @pytest.mark.skipif( - ComparableVersion(xarray.__version__) < "2024.07.0" and ComparableVersion(numpy.__version__) >= "2.0.0", - reason="This test doesn't work due to numpy 2 compatibility issue in xarray below 2024.7.0", - ) def test_assert_xarray_dataset_allclose_empty_coords_handling(self): expected = xarray.Dataset( { diff --git a/tests/udf/test_xarraydatacube.py b/tests/udf/test_xarraydatacube.py index a36733161..bb812a675 100644 --- a/tests/udf/test_xarraydatacube.py +++ b/tests/udf/test_xarraydatacube.py @@ -76,6 +76,9 @@ def _build_xdc( """ Build multi-dimensional XarrayDataCube containing given dimensions/coordinates """ + if isinstance(ts, list) and all(isinstance(t, numpy.datetime64) for t in ts): + # Normalize to "ns" resolution (best compatibility with defaults across old/new versions of xarray/netCDF) + ts = [numpy.datetime64(t, "ns") for t in ts] dims = [] coords = {} value = numpy.zeros(shape=())