-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
What happened?
Trying to update xarray from v2025.12.01 to v2026.02.01, I'm getting the test failures in the log below.
What did you expect to happen?
No failures
Minimal Complete Verifiable Example
Irrelevant.
Steps to reproduce
If you have Nix, you can run:
git clone https://github.com/doronbehar/nixpkgs --branch pkg/xarray
cd nixpkgs
$EDITOR pkgs/development/python-modules/xarray/default.nix # Remove the `disabledTestPaths` list
nix build -Lf. python3.pkgs.xarrayMVCE confirmation
- New issue — a search of GitHub Issues suggests this is not a duplicate.
- Recent environment — the issue occurs with the latest version of xarray and its dependencies.
Relevant log output
=================================== FAILURES ===================================
_____________________ TestDataArray.test_curvefit_helpers ______________________
self = <xarray.tests.test_dataarray.TestDataArray object at 0x7fff23adf160>
def test_curvefit_helpers(self) -> None:
def exp_decay(t, n0, tau=1):
return n0 * np.exp(-t / tau)
from xarray.computation.fit import _get_func_args, _initialize_curvefit_params
params, func_args = _get_func_args(exp_decay, [])
assert params == ["n0", "tau"]
param_defaults, bounds_defaults = _initialize_curvefit_params(
params, {"n0": 4}, {"tau": [5, np.inf]}, func_args
)
assert param_defaults == {"n0": 4, "tau": 6}
assert bounds_defaults == {"n0": (-np.inf, np.inf), "tau": (5, np.inf)}
# DataArray as bound
param_defaults, bounds_defaults = _initialize_curvefit_params(
params=params,
p0={"n0": 4},
bounds={"tau": [DataArray([3, 4], coords=[("x", [1, 2])]), np.inf]},
func_args=func_args,
)
assert param_defaults["n0"] == 4
assert (
param_defaults["tau"] == xr.DataArray([4, 5], coords=[("x", [1, 2])])
).all()
assert bounds_defaults["n0"] == (-np.inf, np.inf)
assert (
bounds_defaults["tau"][0] == DataArray([3, 4], coords=[("x", [1, 2])])
).all()
assert bounds_defaults["tau"][1] == np.inf
param_names = ["a"]
params, func_args = _get_func_args(np.power, param_names)
assert params == param_names
> with pytest.raises(ValueError):
^^^^^^^^^^^^^^^^^^^^^^^^^
E Failed: DID NOT RAISE <class 'ValueError'>
/build/source/xarray/tests/test_dataarray.py:4911: Failed
____________________ TestIndexVariable.test_concat_periods _____________________
self = <xarray.tests.test_variable.TestIndexVariable object at 0x7fff230b2650>
def test_concat_periods(self):
periods = pd.period_range("2000-01-01", periods=10)
coords = [IndexVariable("t", periods[:5]), IndexVariable("t", periods[5:])]
expected = IndexVariable("t", periods)
> actual = IndexVariable.concat(coords, dim="t")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/build/source/xarray/tests/test_variable.py:2627:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/build/source/xarray/core/variable.py:2863: in concat
data = maybe_coerce_to_str(data, variables)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/build/source/xarray/core/utils.py:215: in maybe_coerce_to_str
result_type = dtypes.result_type(*original_coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/build/source/xarray/core/dtypes.py:323: in result_type
if should_promote_to_object(arrays_and_dtypes, xp):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/build/source/xarray/core/dtypes.py:276: in should_promote_to_object
result_type = array_api_compat.result_type(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
xp = <module 'numpy' from '/nix/store/3zydgxpc2gixvxwy77by5v1w8wvvmi9j-python3.13-numpy-2.4.2/lib/python3.13/site-packages/numpy/__init__.py'>
arrays_and_dtypes = (<xarray.IndexVariable 't' (t: 5)> Size: 40B
<PeriodArray>
['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04', '2000-01-05']
Length: 5, dtype: period[D],)
def result_type(*arrays_and_dtypes, xp) -> np.dtype:
if xp is np or any(
isinstance(getattr(t, "dtype", t), np.dtype) for t in arrays_and_dtypes
):
> return xp.result_type(*arrays_and_dtypes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E ValueError: Could not convert <xarray.IndexVariable 't' (t: 5)> Size: 40B
E <PeriodArray>
E ['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04', '2000-01-05']
E Length: 5, dtype: period[D] to a NumPy dtype (via `.dtype` value period[D]).
/build/source/xarray/compat/array_api_compat.py:44: ValueError
=============================== warnings summary ===============================
xarray/tests/test_computation.py: 16 warnings
/nix/store/3zydgxpc2gixvxwy77by5v1w8wvvmi9j-python3.13-numpy-2.4.2/lib/python3.13/site-packages/numpy/lib/_nanfunctions_impl.py:1997: RuntimeWarning: Degrees of freedom <= 0 for slice.
var = nanvar(a, axis=axis, dtype=dtype, out=out, ddof=ddof,
xarray/tests/test_dataarray.py::TestDataArray::test_fillna_extension_array[categorical]
xarray/tests/test_dataarray.py::TestDataArray::test_fillna_extension_array[categorical]
xarray/tests/test_dataset.py::TestDataset::test_fillna_extension_array[category]
xarray/tests/test_dataset.py::TestDataset::test_fillna_extension_array[category]
/nix/store/val4xsnkjivivvxnkdppb5b9fmwvd5fs-python3.13-pandas-2.3.3/lib/python3.13/site-packages/pandas/core/dtypes/common.py:1663: DeprecationWarning: Data type alias 'a' was deprecated in NumPy 2.0. Use the 'S' alias instead.
npdtype = np.dtype(dtype)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED xarray/tests/test_dataarray.py::TestDataArray::test_curvefit_helpers - Failed: DID NOT RAISE <class 'ValueError'>
FAILED xarray/tests/test_variable.py::TestIndexVariable::test_concat_periods - ValueError: Could not convert <xarray.IndexVariable 't' (t: 5)> Size: 40B
= 2 failed, 7138 passed, 9228 skipped, 21 xfailed, 6 xpassed, 20 warnings in 105.22s (0:01:45) =Anything else we need to know?
These errors were reported here:
And indeed one of the was fixed in:
But not the other 2.
Reactions are currently unavailable