diff --git a/tests/test_partitioning.py b/tests/test_partitioning.py index afda363c9..8afc8f9a1 100644 --- a/tests/test_partitioning.py +++ b/tests/test_partitioning.py @@ -1,18 +1,24 @@ from __future__ import annotations +import warnings + import numpy as np +import pytest import xarray as xr +from packaging.version import Version from xclim.ensembles import fractional_uncertainty, hawkins_sutton, lafferty_sriver -from xclim.ensembles._filters import ( # noqa: F401 - _concat_hist, - _model_in_all_scens, - _single_member, -) +from xclim.ensembles._filters import _concat_hist, _model_in_all_scens, _single_member +# FIXME: Investigate why _concat_hist() fails on xarray 2024.5.0 def test_hawkins_sutton_smoke(open_dataset): """Just a smoke test.""" + if Version(xr.__version__) == Version("2024.5.0"): + pytest.skip("xarray 2024.5.0 does not support `_concat_hist()` here.") + if Version(xr.__version__) > Version("2024.5.0"): + warnings.warn("FIXME: Remove this warning if this test is passing.") + dims = {"run": "member", "scen": "scenario"} da = ( open_dataset("uncertainty_partitioning/cmip5_pr_global_mon.nc") diff --git a/xclim/ensembles/_filters.py b/xclim/ensembles/_filters.py index 5d24c5c8e..e800b94e6 100644 --- a/xclim/ensembles/_filters.py +++ b/xclim/ensembles/_filters.py @@ -51,7 +51,6 @@ def _concat_hist(da: xr.DataArray, **hist) -> xr.DataArray: # Select historical scenario and drop it from the data h = da.sel(**hist).dropna("time", how="all") - h = h.drop_vars(dim) ens = da.drop_sel(**hist) index = ens[dim]