Skip to content

Commit

Permalink
upstream-dev CI: Fix interp and cumtrapz (#8861)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian authored Mar 21, 2024
1 parent 84dc961 commit bd9495f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 3 additions & 5 deletions xarray/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -7052,12 +7052,10 @@ def test_cumulative_integrate(dask) -> None:
# along x
actual = da.cumulative_integrate("x")

# From scipy-1.6.0 cumtrapz is renamed to cumulative_trapezoid, but cumtrapz is
# still provided for backward compatibility
from scipy.integrate import cumtrapz
from scipy.integrate import cumulative_trapezoid

expected_x = xr.DataArray(
cumtrapz(da.compute(), da["x"], axis=0, initial=0.0),
cumulative_trapezoid(da.compute(), da["x"], axis=0, initial=0.0),
dims=["x", "y"],
coords=da.coords,
)
Expand All @@ -7073,7 +7071,7 @@ def test_cumulative_integrate(dask) -> None:
# along y
actual = da.cumulative_integrate("y")
expected_y = xr.DataArray(
cumtrapz(da, da["y"], axis=1, initial=0.0),
cumulative_trapezoid(da, da["y"], axis=1, initial=0.0),
dims=["x", "y"],
coords=da.coords,
)
Expand Down
4 changes: 3 additions & 1 deletion xarray/tests/test_interp.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,9 @@ def test_interpolate_chunk_1d(

dest[dim] = cast(
xr.DataArray,
np.linspace(before, after, len(da.coords[dim]) * 13),
np.linspace(
before.item(), after.item(), len(da.coords[dim]) * 13
),
)
if chunked:
dest[dim] = xr.DataArray(data=dest[dim], dims=[dim])
Expand Down

0 comments on commit bd9495f

Please sign in to comment.