Unreadable shards containing partial chunks #981
-
|
Hello Icechunk community, Many thanks to all the devs for this excellent work! As an example, the code below creates 3 array (lat/lon dimensions + variable), without Icechunk and the output is a readable output_path=f"/output/path/file1.zarr"
store = zarr.storage.LocalStore(root=output_path)
lats = zarr.create_array(name="lat",
store=store,
dimension_names=['lat'],
shape=(1001),
chunks=(10,),
shards=(100,),
dtype='float32',
overwrite=True)
lats[:] = np.linspace(35, 70, 1001)
lons = zarr.create_array(name="lon",
store=store,
dimension_names=['lon'],
shape=(1001),
chunks=(10,),
shards=(100,),
dtype='float32',
overwrite=True)
lons[:] = np.linspace(-10, 30, 1001)
var = zarr.create_array(name="variable_name",
store=store,
dimension_names=['lat', 'lon'],
shape=(1001, 1001),
chunks=(10, 10),
shards=(100, 100),
dtype='float32',
overwrite=True)
var[:] = np.random.randint(0, 100, size=(1001, 1001))
ds_zarr = xr.open_zarr(store=store, consolidated=False)
ds_zarrHere is a very similar script using Icechunk to write the zarr file: output_path=f"/output/path/file2.zarr"
storage = icechunk.local_filesystem_storage(output_path)
repo = icechunk.Repository.open_or_create(storage=storage)
session = repo.writable_session("main")
store = session.store
lats = zarr.create_array(name="lat",
store=store,
dimension_names=['lat'],
shape=(1001),
chunks=(10,),
shards=(100,),
dtype='float32',
overwrite=True)
lats[:] = np.linspace(35, 70, 1001)
lons = zarr.create_array(name="lon",
store=store,
dimension_names=['lon'],
shape=(1001),
chunks=(10,),
shards=(100,),
dtype='float32',
overwrite=True)
lons[:] = np.linspace(-10, 30, 1001)
var = zarr.create_array(name="variable_name",
store=store,
dimension_names=['lat', 'lon'],
shape=(1001, 1001),
chunks=(10, 10),
shards=(100, 100),
dtype='float32',
overwrite=True)
var[:] = np.random.randint(0, 100, size=(1001, 1001))
session.commit("Created array with icechunk")
session = repo.readonly_session("main")
store = session.store
ds_zarr = xr.open_zarr(store=store, consolidated=False)
ds_zarrThis last script gives the following error: Thus, I wonder what is happening there? There is probably a good reason for this not working and I'd understand it. Edit: in case this may impact: zarr.__version__ = '3.0.8'
icechunk.__version__ = '0.2.15'
xarray.__version__ = '2025.4.0' |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Thanks @malosellier for opening this issue and the nice example. We'll take a look and get back to you. |
Beta Was this translation helpful? Give feedback.
-
|
Closing discussion as answered in #1019 |
Beta Was this translation helpful? Give feedback.
Tracking this in a bug report here: #1019