`broadcast_like()` doesn't copy chunking structure
Open
Nobody has claimed this yet.
topic-dask
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
What is your issue?
import dask.array
import xarray as xr
da1 = xr.DataArray(dask.array.ones((3,3), chunks=(1, 1)), dims=["x", "y"])
da2 = xr.DataArray(dask.array.ones((3,), chunks=(1,)), dims=["x"])
da2.broadcast_like(da1).chunksizes
Frozen({'x': (1, 1, 1), 'y': (3,)})
Was surprised to not find any other issues around this. Feels like a major limitation of the method for a lot of use cases. Is there an easy hack around this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the Python reproduction with xarray DataArrays backed by dask arrays and inspect the resulting chunksizes. Trace broadcast_like() to determine how the existing array's chunking is handled, then add regression coverage showing that the broadcast result preserves the intended chunking structure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100