Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Doctest failing with numpy 2.1.3 #10005

Closed
5 tasks
kmuehlbauer opened this issue Jan 30, 2025 · 2 comments · Fixed by #10008
Closed
5 tasks

Doctest failing with numpy 2.1.3 #10005

kmuehlbauer opened this issue Jan 30, 2025 · 2 comments · Fixed by #10008
Labels
bug needs triage Issue that has not been reviewed by xarray team member release-blocker

Comments

@kmuehlbauer
Copy link
Contributor

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

INSTALLED VERSIONS ------------------ commit: 151b89a python: 3.12.8 | packaged by conda-forge | (main, Dec 5 2024, 14:24:40) [GCC 13.3.0] python-bits: 64 OS: Linux OS-release: 6.8.0-1020-azure machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: C.UTF-8 LOCALE: ('C', 'UTF-8') libhdf5: 1.14.4 libnetcdf: 4.9.2

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

@kmuehlbauer kmuehlbauer added bug needs triage Issue that has not been reviewed by xarray team member labels Jan 30, 2025
@kmuehlbauer
Copy link
Contributor Author

@keewis If you are around, can you make something out of this?

@keewis
Copy link
Collaborator

keewis commented Jan 30, 2025

I'll look into it

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug needs triage Issue that has not been reviewed by xarray team member release-blocker
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants