Skip to content

Commit

Permalink
revert changes, mark test as failing for xarray 2024.5.0 but not for …
Browse files Browse the repository at this point in the history
…newer versions
  • Loading branch information
Zeitsperre committed Jun 7, 2024
1 parent ca4822b commit dc80f45
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
16 changes: 11 additions & 5 deletions tests/test_partitioning.py
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
1 change: 0 additions & 1 deletion xclim/ensembles/_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit dc80f45

Please sign in to comment.