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

create_position fails when inconsistent row/column capitalization is used #253

Open
ieivanov opened this issue Sep 30, 2024 · 2 comments · Fixed by #254
Open

create_position fails when inconsistent row/column capitalization is used #253

ieivanov opened this issue Sep 30, 2024 · 2 comments · Fixed by #254
Labels
NGFF OME-NGFF (OME-Zarr format)

Comments

@ieivanov
Copy link
Contributor

create_position fails with following example:

from iohub import open_ome_zarr

ds = open_ome_zarr("~/Documents/tmp.zarr", layout='hcs', mode='w', channel_names=['GFP'])

ds.create_position('S', '0', '1')
ds.create_position('s', '1', '0')

ds.close()

throwing error:

Traceback (most recent call last):
  File "/Users/ivan.ivanov/Documents/GitHub/iohub/debug.py", line 6, in <module>
    ds.create_position('s', '1', '0')
  File "/Users/ivan.ivanov/Documents/GitHub/iohub/iohub/ngff/nodes.py", line 1614, in create_position
    well = self.create_well(
  File "/Users/ivan.ivanov/Documents/GitHub/iohub/iohub/ngff/nodes.py", line 1559, in create_well
    row_grp = self.zgroup.create_group(
  File "/Users/ivan.ivanov/miniconda3/envs/iohub/lib/python3.10/site-packages/zarr/hierarchy.py", line 978, in create_group
    return self._write_op(self._create_group_nosync, name, overwrite=overwrite)
  File "/Users/ivan.ivanov/miniconda3/envs/iohub/lib/python3.10/site-packages/zarr/hierarchy.py", line 952, in _write_op
    return f(*args, **kwargs)
  File "/Users/ivan.ivanov/miniconda3/envs/iohub/lib/python3.10/site-packages/zarr/hierarchy.py", line 984, in _create_group_nosync
    init_group(self._store, path=path, chunk_store=self._chunk_store, overwrite=overwrite)
  File "/Users/ivan.ivanov/miniconda3/envs/iohub/lib/python3.10/site-packages/zarr/storage.py", line 682, in init_group
    _init_group_metadata(store=store, overwrite=overwrite, path=path, chunk_store=chunk_store)
  File "/Users/ivan.ivanov/miniconda3/envs/iohub/lib/python3.10/site-packages/zarr/storage.py", line 727, in _init_group_metadata
    raise ContainsGroupError(path)
zarr.errors.ContainsGroupError: path 's' contains a group

It seem like zarr (or the OS) does make a distinction between S and s. This is causing problems in #252

@ieivanov
Copy link
Contributor Author

@ziw-liu how do you suggest we fix this issue? Does ome-zarr recommend one or the other? Should we stick to only lower or upper case row/column names? Or at least enforce consistent lower/upper case names?

@ieivanov ieivanov linked a pull request Oct 2, 2024 that will close this issue
@ieivanov ieivanov reopened this Oct 2, 2024
@ziw-liu
Copy link
Collaborator

ziw-liu commented Oct 7, 2024

The NGFF v0.4 specification states that row and column names 'MUST be case-sensitive'. Although the Zarr specification v2 does not say anything about case, v3 does state that node names are case-sensitive.

However, Windows and macOS paths are case-insensitive by default. I think a warning when creating potentially confusing paths and limiting the test examples is better than the hidden str.lower() done in #254.

@ziw-liu ziw-liu added the NGFF OME-NGFF (OME-Zarr format) label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NGFF OME-NGFF (OME-Zarr format)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants