Uh oh!
There was an error while loading. Please reload this page.
New chunking approach that never splits encoded chunks - #11060
Conversation
Uh oh!
There was an error while loading. Please reload this page.
| ({"x": "preserve", "y": -1}, (160, 500)), | ||
| ], | ||
| ) | ||
| def test_open_dataset_chunking_zarr_with_preserve( |
There was a problem hiding this comment.
These tests are kind of slow.
jsignell
commented
Mar 10, 2026
@dcherian is this something you would be able to review? I'd love to get more people trying it. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
* Move ``preserve_chunks`` to base ChunkManager class * Get target size from dask config options for DaskManager * Add test for open_zarr
…11230) * Add inherit='all' option to DataTree.to_dataset() * Add whats-new entry for inherit='all' (pydata#11230) * Fix prune() signature accidentally modified by ruff-format * Fix mypy errors: remove unused type-ignore, add typing.cast in test * Rename inherit='all' to inherit='all_coords' per review feedback
6512217 to
ca22bd6Compareca22bd6 to
4bea2b3CompareOk @dcherian this is now a PR that changes the behavior of This would be what the commit looks like to add the option jsignell@84cca20 |
jsignell
commented
Apr 23, 2026
I can make this not change the existing behavior at all if we want to do a slow rollout where people would do: importxarrayasxrwithxr.set_options(use_dask_auto=False):
ds=xr.open_zarr("gs://gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3", chunks="auto") |
chunks={}orchunks="auto". Since Remove special mapping ofautoto {} inopen_zarr#11010 got in xarra could eventually change the default onopen_zarrto map it to"preserve"rather than to{}if dask is available.whats-new.rstapi.rstProposal
A new
chunksoption that is only allowed to use encoded chunks or multiples of them. No chunk splitting allowed.Demo
Current behavior when
chunks="auto"This PR introduces a new option:
chunks="preserve"Context
I originally set out to update the
auto_chunksfunction in dask, but it felt like my goals were actually quite different. The goal of the daskauto_chunksfunction is to guarantee that the chunksize will be under a configurable limit while preserving the aspect ratio ofprevious_chunks(previous_chunks==encoding). This PR instead guarantees that encoded chunks are never split but it will multiply them by some factor to try to get the chunksize close to a targetsize. It doesn't try to preserve the aspect ratio of the chunks. Instead it goes after the dim where there is the greatest number of chunks and it tries to take those in bigger bites.Also:
"preserve".