Repository navigation
Conversation
| ({"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.
|
@dcherian is this something you would be able to review? I'd love to get more people trying it. |
* 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
ca22bd6
Compare
ca22bd6 to
4bea2b3
Compare
|
Ok @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 |
|
I can make this not change the existing behavior at all if we want to do a slow rollout where people would do: import xarray as xr
with xr.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") |
|
I was just reminded of this PR and remembered that I still care about it! I am going to update this branch and include the option setting so that people can get back to the previous behavior. |
|
Sorry, I can review when you're done. I don't think an option is warranted, by saying "auto:, the user has already opted in to magic. |
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".