Skip to content

Nested groups not listed in zarr store (?) #2830

@aladinor

Description

@aladinor

Zarr version

v3.0.1

Numcodecs version

v0.15.0

Python Version

312

Operating System

Linux

Installation

Conda

Description

I am trying to create a Zarr store with nested groups using Dataset.to_zarr. The structure I aim to create looks like this:

/
├── Group1
│   ├── a () int64
│   ├── b () int64
│   └── subgroup1
│       ├── a () int64
│       └── b () int64
├── Group2
│   ├── a (2,) int64
│   └── b (2,) float64
├── a (3,) int64
└── set0 (2,) int64

To generate this Zarr store, I use the following code:

Steps to reproduce

import xarray as xr

root_data = xr.Dataset({"a": ("y", [6, 7, 8]), "set0": ("x", [9, 10])})
set1_data = xr.Dataset({"a": 0, "b": 1})
set2_data = xr.Dataset({"a": ("y", [2, 3]), "b": ("x", [0.1, 0.2])})
root_data.to_zarr("unaligned.zarr")
set1_data.to_zarr("unaligned.zarr", group="/Group1", mode="a")
set2_data.to_zarr("unaligned.zarr", group="/Group2", mode="a")
set1_data.to_zarr("unaligned.zarr", group="/Group1/subgroup1", mode="a")

When opening the store using zarr.open_group and listing the group members, only the root-level variables are displayed:

store = zarr.open_group("unaligned.zarr")

print([path for path, _ in store.members(max_depth=1000)])
['a', 'set0']

Expected Behavior
In Zarr-Python V2, the nested groups would be listed as expected:

['/', '/Group1', '/Group1/subgroup1', '/Group2']

For more context, please look at this conversation

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions