Skip to content

_iter_chunk_keys iterates over the wrong shape #3293

@d-v-b

Description

@d-v-b
>>> import zarr
>>> store = {}
>>> z = zarr.create_array(store=store, shape=(10,), chunks=(1,), shards=(3,))
>>> z[:] = 5
>>> tuple(z._iter_chunk_keys())
('c/0', 'c/1', 'c/2', 'c/3', 'c/4', 'c/5', 'c/6', 'c/7', 'c/8', 'c/9')
>>> store.keys()
dict_keys(['zarr.json', 'c/0', 'c/1', 'c/2', 'c/3'])

The solution is to fix _iter_chunk_coords to iterate over the shard shape, not the chunk shape.

xref #3217

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions