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

Improved docs for zarr encoding options. #9987

Open
benritchie opened this issue Jan 26, 2025 · 2 comments
Open

Improved docs for zarr encoding options. #9987

benritchie opened this issue Jan 26, 2025 · 2 comments
Labels
topic-documentation topic-zarr Related to zarr storage library

Comments

@benritchie
Copy link

What is your issue?

Hi
I'm been trying to set zarr encoding options from xarray. (zarr3)

Figuring out how to do this isn't straightforward. It wasn't too hard to get this working for most zarr compressors, but getting it working for array-to-bytes codecs - ZFPY and PCodec was rather harder. (the 2 ArrayBytesCodecs). It turned out the issue is that array bytes codecs need specifying as serialisers, rather than as compressors in the encoding object.

Anyway - to cut to the chase, I think some better documentation of the format of the encoding object would be useful. - I've not been able to find any, and resorted to source code reading to find the above parameter.

I'm happy to help write this if useful, but could use a pointer for the best place to put the doc. (I'm new to making xarray changes).

should say though - the fact this works at all just a few days after zarr3 release is great!

Thanks

Format strings that seem to be working for me are as follows (arguably maybe the details of codec naming belong more in zarr land, but at least the serializer keyword is as far as I can see a xarray invention, so should be documented in xarray):

For ArrayBytesCodecs:

encoding = {"serializer": numcodecs.zarr3.()}

For ArrayBytesCodecs:
if in numcodecs:
encoding = {"compressor": numcodecs.zarr3.()}

and if native zarr3:
(note different codec name format)
encoding = {"compressor": zarr.codecs.ZstdCodec()}

@benritchie benritchie added the needs triage Issue that has not been reviewed by xarray team member label Jan 26, 2025
Copy link

welcome bot commented Jan 26, 2025

Thanks for opening your first issue here at xarray! Be sure to follow the issue template!
If you have an idea for a solution, we would really welcome a Pull Request with proposed changes.
See the Contributing Guide for more.
It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better.
Thank you!

@TomNicholas TomNicholas added topic-documentation topic-zarr Related to zarr storage library and removed needs triage Issue that has not been reviewed by xarray team member labels Jan 27, 2025
@dcherian
Copy link
Contributor

Thanks for volunteering to contribute!

On the xarray end you can pass whatever is accepted by Zarr. So perhaps the best thing to do is write out a line and example to that effect, and add more detailed docs over at Zarr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-documentation topic-zarr Related to zarr storage library
Projects
None yet
Development

No branches or pull requests

3 participants