-
Notifications
You must be signed in to change notification settings - Fork 54
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
Validate ome.zarr file with the python library? #400
Comments
try this (I definitely need to add a CLI like this to # /// script
# requires-python = ">=3.9"
# dependencies = [
# "pydantic-ome-ngff==0.6.1",
# "zarr < 3.0.0"
# ]
# ///
import zarr
from pydantic_ome_ngff.v04 import MultiscaleGroup
import sys
fname = sys.argv[1]
group = zarr.open_group(fname, mode='r')
print(f'validating {fname}')
try:
MultiscaleGroup.from_zarr(group)
print(f'validation of {fname} succeeded.')
except ValueError as e:
print(f'validation failed with the following message: {e}') invoke it with hatch or uv or any other tool that understands the python stand-alone script syntax:
According to my tool, |
when I look at your metadata, the only thing that stands out (besides the lack of a translation transformation defined for each scale level) is the unit, which is non-standard but the spec is not normative about the unit, so that shouldn't be a validation error. |
|
Thanks for the feedback:
The answers take care of my immediate issue, but I think it would be nice to have a straight forward CLI for validation (ideally here in the library, but via pydantic_ome_ngff would also be a good solution). I will leave it open, but feel free to close if not relevant. |
Agreed, for that effort it would be helpful to know what exactly you want to validate. There are a few scenarios:
these correspond to rather different data models. |
@d-v-b : for my use-case I would want to validate that all groups in a hierarchy are either multi-scale groups or contain multiscale groups. For some context: this issue arose while converting light-sheet data to ome.zarr for the ome-ngff-challenge. For this data we currently use the BDV.N5 data model and somehow need to map this to ome.zarr. See ome/ome2024-ngff-challenge#45 for details. |
👍 for that in general. |
Is there a way to validate a ome.zarr file with the python library to check if it follows the spec?
I checked the documentation, but could not find a dedicated function for it.
The closest I found was
ome_zarr info
, but for the file I want to validate it does not yield any output:I have made the file available for testing here: https://drive.google.com/file/d/1WSHQWkOXUfSBahOJdVzrKbj91mczKhZP/view?usp=sharing.
And any other way to validate the file would also be fine with me.
The text was updated successfully, but these errors were encountered: