-
Notifications
You must be signed in to change notification settings - Fork 65
Ome zarr v0.5 reading and writing #413
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
Conversation
Fixes TypeError: Unsupported type for store_like: 'LocalPath'
for more information, see https://pre-commit.ci
|
This pull request has been mentioned on Image.sc Forum. There might be relevant details there: https://forum.image.sc/t/reading-ome-zarr-v0-5-with-python/114280/4 |
|
Consider updating documentation: |
|
Thanks @ralfox - I'm away now and all next week but will get back to this on return... |
|
It looks like the docs in this PR are working OK based on my testing and the comment and the last comment on the forum discussion above: https://forum.image.sc/t/reading-ome-zarr-v0-5-with-python/114280/4. |
|
Apologies @ralfox - the confusing and unnecessary line: |
Also, pass the compressor to da.to_zarr()
15a1df5 to
1cf5273
Compare
joshmoore
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really only one main thought re: --version, otherwise super excited to get this out. ❤️
ome_zarr/cli.py
Outdated
| ) | ||
| parser_create.add_argument("path") | ||
| parser_create.add_argument( | ||
| "--version", help="OME-Zarr version to create. e.g. '0.4'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--version is kinda universally "tell me the current version of the library". I could see calling this --format and then if need be, it could even take a class name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in 1a5b773
tests/test_writer.py
Outdated
| # skip test - can't get this to pass. Fails with: | ||
| # ValueError: compressor cannot be used for arrays with zarr_format 3. | ||
| # Use bytes-to-bytes codecs instead. | ||
| pytest.skip("Dask arrays not supported with zarr v3") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just adding a written reminder of our chat: 👍 for having a reproducer for this.
Nothing to add, just very excited for this to land! |
|
Thanks, @will-moore! Moving forward with the RC. |
NB: this is on top of #404 (reading OME-Zarr v0.5), which needs to be reviewed & merged first
This PR adds support for writing OME-Zarr v0.5, which becomes the default
CurrentFormat().If you want to choose e.g. v0.4, this is specified in
parse_url():This creates a
zarr v2store and group. So when wewrite_image()with that group, we know that we want to usev0.4rather thanv0.5. The defaultfmtforwrite_image()and other write... methods is nowNonerather thanCurrentFormat(), so that we can detect when a user hasn't specified a format and pick the right one.if you try to use a mix of formats, e.g. v04 and v05, this will throw an Exception:
Same with this, since
parse_url()will useCurrentFormat():Known issues:
da.to_zarr()usesAsyncArray._create()which doesn't supportcompressor. See https://github.com/zarr-developers/zarr-python/blob/b877f89fa2959e15d3d49bf027792fb23ce97b84/src/zarr/core/array.py#L609Testing:
Reading via napari-ome-zarr... images and plates, v0.1, 0.3, 0.4, 0.5...
$ napari --plugin napari-ome-zarr https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.1/9836844.zarr$ napari --plugin napari-ome-zarr https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.3/idr0079A/9836998.zarr$ napari --plugin napari-ome-zarr https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0072B/9512.zarr$ napari --plugin napari-ome-zarr https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.5/idr0083/9822152.zarr$ napari --plugin napari-ome-zarr https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.5/idr0010/76-45.ome.zarrSee the changes in
docs/source/python.rstand test the various code samples. By default, the examples will write OME-Zarrv0.5. Also try writingv0.4as described.