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

DOC: Custom ArrayArray Codecs in Zarr 3+ #2885

Open
dimitri-yatsenko opened this issue Mar 3, 2025 · 2 comments
Open

DOC: Custom ArrayArray Codecs in Zarr 3+ #2885

dimitri-yatsenko opened this issue Mar 3, 2025 · 2 comments
Labels
documentation Improvements to the documentation help wanted Issue could use help from someone with familiarity on the topic

Comments

@dimitri-yatsenko
Copy link

Describe the issue linked to the documentation

I previously created a precompression quantization codec for multiphoton microscopy soon to be published in Nature Protocols preprint.

The Zarr V2 implementation works great and can be found here:

However, I tried following the best available instructions for an equivalent Zarr V3 implementation and have not been able to get it to work yet.

If I can figure out how to implement and use a custom codec in Zarr 3, I will write a nice tutorial.

Suggested fix for documentation

No response

@dimitri-yatsenko dimitri-yatsenko added documentation Improvements to the documentation help wanted Issue could use help from someone with familiarity on the topic labels Mar 3, 2025
@d-v-b
Copy link
Contributor

d-v-b commented Mar 3, 2025

thanks for the issue! I see this error in the notebook:

File ~/opt/miniconda3/envs/anscombe_numcodecs/lib/python3.11/site-packages/zarr/abc/codec.py:134, in BaseCodec._encode_single(self, chunk_data, chunk_spec)
    131 async def _encode_single(
    132     self, chunk_data: CodecInput, chunk_spec: ArraySpec
    133 ) -> CodecOutput | None:
--> 134     raise NotImplementedError

NotImplementedError: 

It looks like your codec class does not implement a require method (_encode_single). I would implement that method for your codec, along with the other methods on the codec abc.

On our end, this method should probably have been explicitly decorated as an abstract method so that subclass creation would fail, instead of the later failure we see here.

@dimitri-yatsenko
Copy link
Author

@d-v-b Thank you.

I have updated the method name _encode_single (I had a typo previously). Here is the new error:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements to the documentation help wanted Issue could use help from someone with familiarity on the topic
Projects
None yet
Development

No branches or pull requests

2 participants