-
I'm trying to investigate/learn how dask chunks get translated to Zarr v3 shards (or chunks?). So I'm working with an example where I save a Dask array to a zarr and then try to open it with zarr-python to inspect the shard size. From this comment it sounds like dask chunks get translated to shards: pydata/xarray#9938 (reply in thread) import xarray as xr
import dask.array as da
import numpy as np
import zarr
ar = da.random.random((4096, 4096), chunks=(64, 64))
dset = xr.DataArray(ar, coords={"x": range(4096), "y": range(4096)}).to_dataset(
name="variables"
)
encoding = {"variables": {"shards": (2048, 2048)}}
dset["variables"].encoding = encoding
dset.to_zarr("test.zarr", zarr_format=3, mode="w")
rt = xr.open_zarr("test.zarr") # has a chunk size same as dask chunk size, not the shard size
import zarr
zarr.open_array(store="test.zarr") #fails The error is
any pointers on how to open this test.zarr with zarr-python? am I missing something about how I should save or open the zarr store? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I was using open_array instead of open woopsidaisy |
Beta Was this translation helpful? Give feedback.
-
Looks like sharding is not used here and must be declared another way. import zarr
x = zarr.open_group("test.zarr")
np.array(x['variables'])
x['variables'].shards -> None |
Beta Was this translation helpful? Give feedback.
I was using open_array instead of open woopsidaisy