Skip to content

zarr.group creates unexpected chain of .zgroups in the store when using the path= kwarg #1257

Description

@ChiliJohnson

Zarr version

v2.13.3

Numcodecs version

N/A

Python Version

3.9.15

Operating System

macOS

Installation

Pip + venv

Description

When using zarr.group with the path kwarg, Zarr will still register .zgroups at the root of the store, all the way down to the specified path. I'm fairly new to Zarr (so I may be missing something) but this feels unexpected to me, I feel like inuitively zarr.group(…, path=…) should only register a .zgroup at the path specified

Steps to reproduce

from pprint import pprint
import zarr

store = {
    "myKey/test.zarr/.zgroup": b'existing content!',
}

try:
    root = zarr.group(store=store, path="myKey/test.zarr", overwrite=False)
except Exception as exc:
    print(exc, "\n")

pprint(store)

Output:

path 'myKey/test.zarr' contains a group 

{'.zgroup': b'{\n    "zarr_format": 2\n}',
 'myKey/.zgroup': b'{\n    "zarr_format": 2\n}',
 'myKey/test.zarr/.zgroup': b'existing content!'}

There are two things to note here I think:

  1. Zarr successfully detects that there is already a group registered at that path in the store
  2. Despite this check, it still registers extra .zgroups from the root of the store down to the specified path

Additional output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions