-
-
Notifications
You must be signed in to change notification settings - Fork 368
Closed
Labels
bugPotential issues with the zarr-python libraryPotential issues with the zarr-python library
Description
Zarr version
v3.1.0
Numcodecs version
v0.16.1
Python Version
3.11
Operating System
Mac
Installation
Using pip into a virtual environment
Description
When loading a group of groups where the top-level group has consolidated metadata, the result of Group.nmembers() includes nested members. This appears to be some issue with ConsolidatedMetadata.flattened_metadata as flattened_metadata.keys() returns children of the first-level members as well.
Steps to reproduce
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "zarr@git+https://github.com/zarr-developers/zarr-python.git@main",
# ]
# ///
#
# This script automatically imports the development branch of zarr to check for issues
import zarr
# create the group on disk
z = zarr.group('foo', zarr_version=3)
for idx in range(0, 10):
idx_str = f'{idx:05d}'
ds = z.create_group(name=idx_str)
ds.create_array(f'data', dtype='uint8', shape=(10, 10))
zarr.consolidate_metadata(z.store)
print('num members at creation:', z.nmembers())
# load from disk
z = zarr.open('foo')
print('num members at load:', z.nmembers())
# print the flattened metadata keys
print()
print(z.metadata.consolidated_metadata.flattened_metadata.keys())Additional output
No response
Metadata
Metadata
Assignees
Labels
bugPotential issues with the zarr-python libraryPotential issues with the zarr-python library