-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
What happened?
When calling numpy.clip
(not xarray.DataArray.clip
), I receive a DeprecationWarning:
site-packages\numpy_core\fromnumeric.py:48: DeprecationWarning: array_wrap must accept context and return_scalar arguments (positionally) in the future. (Deprecated NumPy 2.0)
What did you expect to happen?
That the deprecation warning is fixed.
Minimal Complete Verifiable Example
import xarray as xr
import numpy as np
import warnings
warnings.filterwarnings("always")
da = xr.DataArray(
np.random.rand(4, 3),
dims=("x", "y"),
coords={"x": [0, 1, 2, 3], "y": [0, 1, 2]},
)
clipped = np.clip(da, 0.3, 0.6)
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
site-packages\numpy\_core\fromnumeric.py:48: DeprecationWarning: __array_wrap__ must accept context and return_scalar arguments (positionally) in the future. (Deprecated NumPy 2.0)
Anything else we need to know?
No response
Environment
- python = "==3.12.9"
- xarray = "==2025.1.2"
- numpy = "==2.1.3"