Broken support for `write_empty_chunks` with Zarr v3
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
What happened?
The to_zarr() method accepts a keyword argument write_empty_chunks but the Zarr 3 backend no longer supports it. Instead, it can accept config={'write_empty_chunks': False} but to_zarr does not.
xarray 2025.1.2, zarr 3.0.3
What did you expect to happen?
It would write the data in Zarr skipping the empty chunks..
Minimal Complete Verifiable Example
ds = xr.Dataset(...)
ds.to_zarr(write_empty_chunks=False, ...) # Raises: TypeError: Group.create_array() got an unexpected keyword argument 'write_empty_chunks'
ds.to_zarr(config={'write_empty_chunks': False}, ...) # Unexpected kwarg 'config'
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
Anything else we need to know?
May I also suggest that you add a zarr_backend_kwargs argument that gets passed to the Zarr backend?
Environment
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 at the to_zarr() entry point and trace how its keyword arguments reach the Zarr 3 backend, reproducing the provided write_empty_chunks example with xarray 2025.1.2 and zarr 3.0.3. Done means writing succeeds while skipping empty chunks, with the unsupported argument no longer reaching Group.create_array().
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
- 35/100