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

Why is Array.name nullable? #2498

Closed
d-v-b opened this issue Nov 18, 2024 · 3 comments
Closed

Why is Array.name nullable? #2498

d-v-b opened this issue Nov 18, 2024 · 3 comments

Comments

@d-v-b
Copy link
Contributor

d-v-b commented Nov 18, 2024

The name of an array can be None, which is a bit odd since None is not a valid location in a file system. Can someone explain what we are expressing by allowing Array.name to be None? Note that this is carried over from v2, and the docstring references h5py.

def name(self) -> str | None:
"""Array name following h5py convention.
Returns
-------
str
The name of the array.
"""
if self.path:
# follow h5py convention: add leading slash
name = self.path
if name[0] != "/":
name = "/" + name
return name
return None

@d-v-b
Copy link
Contributor Author

d-v-b commented Nov 18, 2024

My next question is, what would we lose by using the empty string '' instead of None for this case?

@d-v-b
Copy link
Contributor Author

d-v-b commented Nov 18, 2024

I did some quick research and apparently in hdf5, the name of a dataset or a group can be NULL if the array / group is an anonymous group, i.e. a group / dataset has not been added to an extant hierarchy, otherwise it should be a string. We have never supported this in zarr-python, So I don't think zarr-python v2 was correctly modelling hdf5's semantics here, and I don't think we should continue to incorrectly model hdf5.

see #2499

@jhamman
Copy link
Member

jhamman commented Dec 3, 2024

closed by #2499

@jhamman jhamman closed this as completed Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants