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
# /// script# requires-python = ">=3.12"# dependencies = [# "zarr[remote]@git+https://github.com/zarr-developers/zarr-python.git@main",# ]# ///## This script automatically imports the development branch of zarr to check for issuesimportzarrz=zarr.open_consolidated(zarr.storage.FsspecStore.from_url("https://vitessce-demo-data.storage.googleapis.com/anndata-demos/BALF_VIB-UGent_processed_cleaned.zarr/", read_only=True), mode="r")
assertz["raw"].metadata.consolidated_metadataisnotNone# passesassertz["raw"]["varm"].metadata.consolidated_metadataisnotNone# fails
With nested groups, the consolidated metadata is available on the children, recursively
I think this is meant to describe zarr-python's behavior when writing consolidated metadata. What you are observing is data where consolidated metadata was not written to the subgroups.
Could you elaborate a bit? In the following example, I don't see any consolidated metadata written to disk at the subgroups but it is present on the in-memory data when read back in, which is what I would expect given the description of the behavior:
# /// script# requires-python = ">=3.12"# dependencies = [# "zarr@git+https://github.com/zarr-developers/zarr-python.git@main",# ]# ///## This script automatically imports the development branch of zarr to check for issuesfrom __future__ importannotationsimportjsonimportnumpyasnpimportzarrz=zarr.open("foo.zarr", mode="w")
z.create_group("bar")
z["bar"].create_group("fuzz")
z["bar"]["fuzz"].create_group("bazz")
z["bar"]["fuzz"]["bazz"] =np.arange(5)
zarr.consolidate_metadata(z.store)
z=zarr.open("foo.zarr", mode="r")
assertz["bar"]["fuzz"].metadata.consolidated_metadataisnotNone# workswithopen("foo.zarr/bar/zarr.json") asf:
print(json.loads(f.read())) # does not contain metadata i.e., at the next group down
I think it's possible this is a v2 problem since the original store is v2 only!
the v2 thing seems explanatory, but I'm not sure that it makes sense. Evidently I don't know the consolidated metadata semantics very well! maybe @TomAugspurger can explain better how things should work.
IIUC, this is behaving as intended, at least as I understood it. Consolidating metadata takes all the metadata at and under a point in the tree and consolidates it to a single metadata document, which is written to disk. But you need to access it from that consolidation point to use it.
I don't think we would want to write out multiple consolidated metadata documents, one at each node in the tree... Though I see how the asymmetry between zarr.open_consolidate(store)["path/to/group"] and zarr.open(store, path="path/to/group") is jarring.
With nested groups, the consolidated metadata is available on the children, recursively
I'm not sure if I wrote that or not, but in my reading that's making a statement about the in-memory metadata (.metadata.consolidated_metadata) rather than the representation on disk.
I'm not sure if I wrote that or not, but in my reading that's making a statement about the in-memory metadata (.metadata.consolidated_metadata) rather than the representation on disk.
This was my impression as well (same with the on-disk, doesn't make sense to write it all out)
Activity
d-v-b commentedon May 10, 2026
I think this is meant to describe zarr-python's behavior when writing consolidated metadata. What you are observing is data where consolidated metadata was not written to the subgroups.
ilan-gold commentedon May 11, 2026
Could you elaborate a bit? In the following example, I don't see any consolidated metadata written to disk at the subgroups but it is present on the in-memory data when read back in, which is what I would expect given the description of the behavior:
I think it's possible this is a v2 problem since the original store is v2 only!
d-v-b commentedon May 11, 2026
the v2 thing seems explanatory, but I'm not sure that it makes sense. Evidently I don't know the consolidated metadata semantics very well! maybe @TomAugspurger can explain better how things should work.
TomAugspurger commentedon May 11, 2026
IIUC, this is behaving as intended, at least as I understood it. Consolidating metadata takes all the metadata at and under a point in the tree and consolidates it to a single metadata document, which is written to disk. But you need to access it from that consolidation point to use it.
I don't think we would want to write out multiple consolidated metadata documents, one at each node in the tree... Though I see how the asymmetry between
zarr.open_consolidate(store)["path/to/group"]andzarr.open(store, path="path/to/group")is jarring.TomAugspurger commentedon May 11, 2026
With respect to
I'm not sure if I wrote that or not, but in my reading that's making a statement about the in-memory metadata (
.metadata.consolidated_metadata) rather than the representation on disk.ilan-gold commentedon May 11, 2026
This was my impression as well (same with the on-disk, doesn't make sense to write it all out)
TomAugspurger commentedon May 11, 2026
Sorry, I'm just now looking at the original post more closely, and this definitely looks like a bug
I'll take a closer look today.
ilan-gold commentedon May 11, 2026
Thanks!
BUG: Fix empty Group nodes lacking a "consolidated_metadata" field
TomAugspurger commentedon May 12, 2026
See #3967
BUG: Fix empty Group nodes lacking a "consolidated_metadata" field (#…