Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add xarray reduction from dask#10384 #1020

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions tests/benchmarks/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,31 @@ def test_rechunk_out_of_memory(small_client, configure_rechunking):
rng = da.random.default_rng()
x = rng.random((100000, 100000))
x.rechunk((50000, 20)).rechunk((20, 50000)).sum().compute()


@run_up_to_nthreads("small_cluster", 50, reason="fixed dataset")
@pytest.mark.parametrize("backend", ["dataframe", "array"])
def test_xarray_reduction(small_client, backend):
# See https://github.com/dask/dask/issues/10384
xr = pytest.importorskip("xarray")
size = 4000
ds = xr.Dataset(
dict(
anom_u=(
["time", "face", "j", "i"],
da.random.random((size, 1, 987, 1920), chunks=(10, 1, -1, -1)),
),
anom_v=(
["time", "face", "j", "i"],
da.random.random((size, 1, 987, 1920), chunks=(10, 1, -1, -1)),
),
)
)

quad = ds**2
quad["uv"] = ds.anom_u * ds.anom_v
mean = quad.mean("time")
if backend == "dataframe":
mean = mean.to_dask_dataframe()

wait(mean, small_client, 10 * 60)