-
Notifications
You must be signed in to change notification settings - Fork 14
Configurable Zarr3 codecs #1343
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
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
Adding class Zarr3Config:
codecs: Sequence[Zarr3Codec] | None = None
chunk_key_encoding: Zarr3ChunkKeyEncoding | None = None
def add_mag(...,
compress: bool | Zarr3Config = True,
...
) -> MagView:
... |
Changed that in e5fb658 |
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.
LGTM!
I am not an expert when it comes to the exact details of Zarr3 specification and configuration in tensorstore (dimension/byte order etc.). But as long as reading/writing works which should be covered in the tests everything is correct, I guess. :)
See my small comments.
if isinstance(compress, Zarr3Config): | ||
if not self.data_format != DataFormat.Zarr3: | ||
raise ValueError( | ||
"Cannot get_or_add_mag: A Zarr3 config can only be supplied for Zarr3 layers." | ||
) | ||
assert isinstance(mag_view.info, Zarr3ArrayInfo) | ||
if mag_view.info.codecs != compress.codecs: | ||
raise ValueError( | ||
f"Cannot get_or_add_mag: The mag {mag} already exists, but the codecs do not match. Expected {mag_view.info.codecs}, got {compress.codecs}." | ||
) | ||
if mag_view.info.chunk_key_encoding != compress.chunk_key_encoding: | ||
raise ValueError( | ||
f"Cannot get_or_add_mag: The mag {mag} already exists, but the chunk key encoding does not match. Expected {mag_view.info.chunk_key_encoding}, got {compress.chunk_key_encoding}." | ||
) | ||
|
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.
We could also add tests for those assertions. Not super important I would say, though.
Co-authored-by: Tobias <[email protected]>
Description:
Adds options to configure the Zarr3 arrays that are created by wklibs. This is required for generating volume annotations, see also #1340
zarr3_codecs
andzarr3_chunk_key_encoding
parameters toMagView.add_mag
to allow for configuring Zarr3 datasets.sharding_indexed
codec is no longer used ifchunk_shape == shard_shape
.Todos:
Make sure to delete unnecessary points or to check all before merging: