Skip to content

Set allow_rechunk=True in apply_ufunc #4372

@dcherian

Description

@dcherian

What happened:

blockwise calls unify_chunks by default but apply_gufunc does not; so we have a regression in apply_ufunc now that we've switched from blockwise to apply_gufunc.

Minimal Complete Verifiable Example:

import operator

a = xr.DataArray(np.arange(10), dims=("a")).chunk({"a": 2})
b = xr.DataArray(np.arange(10), dims=("a")).chunk({"a": 4})

xr.apply_ufunc(operator.add, a, b, dask="parallelized", output_dtypes=[a.dtype]).compute()

raises

ValueError: Dimension `'__loopdim0__'` with different chunksize present

on master but works with 0.16.0

I think we need to do dask_gufunc_kwargs.setdefault("allow_rechunk", True)

If we want to avoid that, we'll need to go through a deprecation cycle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions