You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reading a dataset fails with zarr 3 (z.data, .zattrs) #167
I'm testing the anemoi packages with zarr 3 and with datasets in zarr format 3, as part of the zarr 3 work in anemoi-datasets (ecmwf/anemoi-datasets#786, and the tracking issue #792). Two places in anemoi-registry only work with zarr 2.
DatasetCatalogueEntry.load_from_path raises AttributeError: 'Group' object has no attribute 'data' with zarr 3, for datasets in format 2 and in format 3. It reads the shape with z.data.shape (entry/dataset.py). Item access, z["data"], works with zarr 2 and 3.
update --catalogue-from-recipe-file reads {tmp}/.zattrs after running init (commands/update.py). A format 3 dataset has zarr.json and no .zattrs, so the read fails. zarr.open(tmp, mode="r").attrs.asdict() works for both formats.
I have a fix in #166. I could not run update against a real catalogue. I ran its code path with the catalogue stubbed and the real init task, and the fix reads variables_metadata on both formats.
Versions. anemoi-registry 0.3.4 (main888ac9e), zarr 3.4.1 with numcodecs 0.17.0 (and zarr 2.18.7 with numcodecs 0.15.2 for comparison), anemoi-datasets from main, Python 3.12, Linux.
How to reproduce
Create a small dataset in each format with anemoi-datasets (output: {format: zarr3} for format 3, from ecmwf/anemoi-datasets#786).
Before the fix, zarr 3.4.1 raises the AttributeError above for both formats. On zarr 2.18.7 it works for format 2.
2.
importzarrfromanemoi.datasets.create.tasksimportrun_taskrun_task("init", recipe="recipe.yaml", path="tmp.zarr", overwrite=True) # recipe with output: {format: zarr3}open("tmp.zarr/.zattrs")
Before the fix, update reads tmp.zarr/.zattrs, which does not exist for a format 3 dataset (FileNotFoundError). zarr.open("tmp.zarr", mode="r").attrs.asdict() returns the attributes for both formats.
Activity