Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aladinor opened this issue Feb 13, 2025 · 1 comment
Open

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

aladinor opened this issue Feb 13, 2025 · 1 comment
Labels
bug Potential issues with the zarr-python library

Comments

@aladinor
Copy link

aladinor commented Feb 13, 2025

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

@aladinor aladinor added the bug Potential issues with the zarr-python library label Feb 13, 2025
@d-v-b
Copy link
Contributor

d-v-b commented Feb 13, 2025

thanks for the report, i'm guessing this is due to how we currently (fail to) handle the leading "/" character in the names. i can look into this in the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Potential issues with the zarr-python library
Projects
None yet
Development

No branches or pull requests

2 participants