-
-
Notifications
You must be signed in to change notification settings - Fork 359
Closed
Labels
bugPotential issues with the zarr-python libraryPotential issues with the zarr-python library
Description
Zarr version
v3.0.1
Numcodecs version
v0.15.0
Python Version
3.12
Operating System
Linux
Installation
conda
Description
Hi everyone,
I am working on fixing incompatibilities between Zarr-Python V3 and xarray DataTrees PR10020 and I found that when opening a consolidated group it will raise the following error,
Steps to reproduce
import zarr
# Create the root group in a directory
root = zarr.open('example.zarr', mode='w')
# Create group 'a' and add variable 'A'
group_a = root.create_group('a')
group_a.create_array('A', shape=(128, 256), dtype='float64', chunks=(64, 256))
# Create group 'c' and add variables 'w' and 'z'
group_c = root.create_group('c')
group_c.create_array('w', shape=(128,), dtype='float64')
group_c.create_array('z', shape=(128, 256), dtype='float64', chunks=(64, 256))
# Create subgroup 'd' under group 'c' and add variable 'G'
group_d = group_c.create_group('d')
group_d.create_array('G', shape=(128, 256), dtype='float64', chunks=(64, 256))
# Consolidate metadata
zarr.consolidate_metadata('example.zarr')
when using zarr.open_consolidated
I got the following error
root = zarr.open_consolidated(
'example.zarr',
mode='r',
path="/c"
)
Traceback (most recent call last):
File "/snap/pycharm-community/439/plugins/python-ce/helpers/pydev/pydevd.py", line 1570, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/pycharm-community/439/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/media/alfonso/drive/Alfonso/python/xarray/delete_Zarr.py", line 38, in <module>
open_zarr_store()
File "/media/alfonso/drive/Alfonso/python/xarray/delete_Zarr.py", line 28, in open_zarr_store
root = zarr.open_consolidated(
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alfonso/mambaforge/envs/xarray-tests/lib/python3.12/site-packages/zarr/api/synchronous.py", line 212, in open_consolidated
sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs))
File "/home/alfonso/mambaforge/envs/xarray-tests/lib/python3.12/site-packages/zarr/core/sync.py", line 142, in sync
raise return_result
File "/home/alfonso/mambaforge/envs/xarray-tests/lib/python3.12/site-packages/zarr/core/sync.py", line 98, in _runner
return await coro
^^^^^^^^^^
File "/home/alfonso/mambaforge/envs/xarray-tests/lib/python3.12/site-packages/zarr/api/asynchronous.py", line 346, in open_consolidated
return await open_group(*args, use_consolidated=use_consolidated, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alfonso/mambaforge/envs/xarray-tests/lib/python3.12/site-packages/zarr/api/asynchronous.py", line 807, in open_group
return await AsyncGroup.open(
^^^^^^^^^^^^^^^^^^^^^^
File "/home/alfonso/mambaforge/envs/xarray-tests/lib/python3.12/site-packages/zarr/core/group.py", line 553, in open
return cls._from_bytes_v3(
^^^^^^^^^^^^^^^^^^^
File "/home/alfonso/mambaforge/envs/xarray-tests/lib/python3.12/site-packages/zarr/core/group.py", line 611, in _from_bytes_v3
raise ValueError(msg)
ValueError: Consolidated metadata requested with 'use_consolidated=True' but not found in 'c'.
Apparently, the open _consolidated
function does not detect the consolidated metadata at each nested node.
Additional output
No response
Metadata
Metadata
Assignees
Labels
bugPotential issues with the zarr-python libraryPotential issues with the zarr-python library