-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
What happened?
Yesterday the doctest started to pull in numpy 2.1.3 (before 2.0.2) and NamedArray aggregations started to fail, returning a scalar instead of an array.
Working: https://github.com/pydata/xarray/actions/runs/13037739319/job/36372249466
Breaking: https://github.com/pydata/xarray/actions/runs/13044017287/job/36391424586
The same still works with DataArray returning an array.
That's a release blocker for #10002.
What did you expect to happen?
Doctest should run.
Minimal Complete Verifiable Example
import numpy as np
from xarray.namedarray.core import NamedArray
na = NamedArray("x", np.array([True, True, True, True, True, False], dtype=bool))
out = na.all()MVCE confirmation
- Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
- Complete example — the example is self-contained, including all data and the text of any traceback.
- Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
- 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
_____ [doctest] xarray.namedarray._aggregations.NamedArrayAggregations.all _____
113 --------
114 >>> from xarray.namedarray.core import NamedArray
115 >>> na = NamedArray(
116 ... "x", np.array([True, True, True, True, True, False], dtype=bool)
117 ... )
118 >>> na
119 <xarray.NamedArray (x: 6)> Size: 6B
120 array([ True, True, True, True, True, False])
121
122 >>> na.all()
Expected:
<xarray.NamedArray ()> Size: 1B
array(False)
Got:
<xarray.NamedArray ()> Size: 1B
np.False_Anything else we need to know?
No response
Environment
xarray: 2025.1.2.dev28+g151b89ac
pandas: 2.2.3
numpy: 2.1.3
scipy: 1.15.1
netCDF4: 1.7.2
pydap: 3.5.3
h5netcdf: 1.5.0
h5py: 3.12.1
zarr: 3.0.1
cftime: 1.6.4
nc_time_axis: 1.4.1
iris: 3.11.0
bottleneck: 1.4.2
dask: 2025.1.0
distributed: 2025.1.0
matplotlib: 3.10.0
cartopy: 0.24.0
seaborn: 0.13.2
numbagg: 0.8.2
fsspec: 2024.12.0
cupy: None
pint: None
sparse: 0.15.5
flox: 0.9.15
numpy_groupies: 0.11.2
setuptools: 75.8.0
pip: 25.0
conda: None
pytest: 8.3.4
mypy: None
IPython: None
sphinx: None