You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Technically it is that Zarr 3 that no longer supports numcodecs. Imagecodecs itself does not use zarr anywhere (except for testing) and does not claim to support zarr 3:
Zarr 3 codecs are much more complicated than numcodecs codecs. They include multi-class inheritance, mixins, dataclasses, async, type hints, partial reads, and whatnot. It's going to be a major task to implement and test zarr 3 compatible codecs for all 64 imagecodecs codecs.
Imagecodecs itself does not use zarr anywhere (except for testing) and does not claim to support zarr 3:
I'm aware; this is a preliminary check before doing any updating.
Zarr 3 codecs are much more complicated than numcodecs codecs. They include multi-class inheritance, mixins, dataclasses, async, type hints, partial reads, and whatnot. It's going to be a major task to implement and test zarr 3 compatible codecs for all 64 imagecodecs codecs.
It appears that this is not specifically Zarr 3, but Zarr file format 3. If you pass zarr_format=2 to create, then at least construction doesn't complain, and cuts down failures to 79. Unfortunately, there's a type mismatch (imagecodecs.*_decode seems to expect uint8_t, but the input is signed char), and I haven't worked out where in the path this arises and thus if it's a bug or not (or with who).
Unfortunately, there's a type mismatch (imagecodecs.*_decode seems to expect uint8_t, but the input is signed char), and I haven't worked out where in the path this arises and thus if it's a bug or not (or with who).
I believe this is a bug in Zarr, as in zarr-developers/zarr-python#2735. If I patch in the correct signedness, then I'm down to 9 test failures of imcd_byteshuffle returned IMCD_VALUE_ERROR (though Fedora doesn't run all codecs yet.)
I might have misunderstood this issue: is the objective merely getting the imagecodecs tests to pass with Zarr 3 installed? Or to support Zarr 3, that is (for me at least) provide Zarr format 3 compatible codecs?
These are the remaining test failures with patched test_imagecodecs.py and patched zarr 3.0.1:
================================================================================= short test summary info =================================================================================
FAILED tests/test_imagecodecs.py::test_numcodecs[byteshuffle-gray] - imagecodecs._imcd.ImcdError: imcd_byteshuffle returned IMCD_VALUE_ERROR
FAILED tests/test_imagecodecs.py::test_numcodecs[byteshuffle-rgb] - imagecodecs._imcd.ImcdError: imcd_byteshuffle returned IMCD_VALUE_ERROR
FAILED tests/test_imagecodecs.py::test_numcodecs[byteshuffle-stack] - imagecodecs._imcd.ImcdError: imcd_byteshuffle returned IMCD_VALUE_ERROR
FAILED tests/test_imagecodecs.py::test_numcodecs[bz2-gray] - ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
FAILED tests/test_imagecodecs.py::test_numcodecs[bz2-rgb] - ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
FAILED tests/test_imagecodecs.py::test_numcodecs[bz2-stack] - ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
FAILED tests/test_imagecodecs.py::test_numcodecs[floatpred-gray] - imagecodecs._imcd.ImcdError: imcd_byteshuffle returned IMCD_VALUE_ERROR
FAILED tests/test_imagecodecs.py::test_numcodecs[floatpred-rgb] - imagecodecs._imcd.ImcdError: imcd_byteshuffle returned IMCD_VALUE_ERROR
FAILED tests/test_imagecodecs.py::test_numcodecs[floatpred-stack] - imagecodecs._imcd.ImcdError: imcd_byteshuffle returned IMCD_VALUE_ERROR
======================================================================== 9 failed, 137 passed, 13 xfailed in 8.55s ========================================================================
I might have misunderstood this issue: is the objective merely getting the imagecodecs tests to pass with Zarr 3 installed? Or to support Zarr 3, that is (for me at least) provide Zarr format 3 compatible codecs?
I only meant Zarr 3 the library, not Zarr 3 the file format. Sorry if that was unclear.
The test failures and hangs with patched Zarr 3 are fixed by:
I've made roughly the same changes, and it's good to see that that full test suite is not that far off from what Fedora runs. The only one I didn't see was the pglz hang. However, I did make the changes in a way as to reduce copies. I can open a PR to review if you want.
The imagecodecs doctests fail with Zarr 3 due to tifffile's Zarr stores not being compatible (but that's an entirely other issue).
And this one I didn't see; I suppose that Fedora doesn't run doctests.
having imagecodecs integrated in Zarr3 again and part of standard codecs
Maybe I am misunderstanding something: imagecodecs was never part of zarr. Imagecodecs currently contains extra numcodecs compatible codec wrappers, which can be used with Zarr 3 and zarr_format=2. The next imagecodecs version will include native Zarr 3 codec wrappers (for zarr_format=3) for ~74 imagecodecs codecs. I can post the preliminary code here if you want to try it out.
thanks for this work @cgohlke, would you have any interest in writing up specs for these codecs over in zarr-extensions? This will make it much easier for multiple implementations to use the same codec. For example, there is an active PR for a jpeg codec, it might be useful to get your input based on your experience with the imagecodecs_jpeg codec.
I just wanted to plus one davis's comment above... i started trying to write something , but I don't feel terribly qualified and I wanted to make sure that it reflected the understanding of some of the actual implementors before opening a PR
Activity
QuLogic commentedon Jan 20, 2025
I actually realized the migration guide doesn't mention
zarr.MemoryStore, so I've reported the above-linked issue to Zarr to clarify how to migrate.QuLogic commentedon Jan 20, 2025
Sorry, Fedora was a bit behind on releases; I've re-built with the latest version https://copr.fedorainfracloud.org/coprs/qulogic/zarr3/build/8547624/ There are only 97 failures in that case, but still of the same style.
cgohlke commentedon Jan 20, 2025
I am aware of the issue.
Technically it is that Zarr 3 that no longer supports numcodecs. Imagecodecs itself does not use zarr anywhere (except for testing) and does not claim to support zarr 3:
imagecodecs/imagecodecs/imagecodecs.py
Line 36 in 988af50
imagecodecs/imagecodecs/imagecodecs.py
Lines 85 to 86 in 988af50
imagecodecs/setup.py
Line 766 in 988af50
Zarr 3 codecs are much more complicated than numcodecs codecs. They include multi-class inheritance, mixins, dataclasses, async, type hints, partial reads, and whatnot. It's going to be a major task to implement and test zarr 3 compatible codecs for all 64 imagecodecs codecs.
QuLogic commentedon Jan 20, 2025
I'm aware; this is a preliminary check before doing any updating.
It appears that this is not specifically Zarr 3, but Zarr file format 3. If you pass
zarr_format=2tocreate, then at least construction doesn't complain, and cuts down failures to 79. Unfortunately, there's a type mismatch (imagecodecs.*_decodeseems to expectuint8_t, but the input issigned char), and I haven't worked out where in the path this arises and thus if it's a bug or not (or with who).QuLogic commentedon Jan 20, 2025
I believe this is a bug in Zarr, as in zarr-developers/zarr-python#2735. If I patch in the correct signedness, then I'm down to 9 test failures of
imcd_byteshuffle returned IMCD_VALUE_ERROR(though Fedora doesn't run all codecs yet.)cgohlke commentedon Jan 20, 2025
I might have misunderstood this issue: is the objective merely getting the imagecodecs tests to pass with Zarr 3 installed? Or to support Zarr 3, that is (for me at least) provide Zarr format 3 compatible codecs?
cgohlke commentedon Jan 20, 2025
These are the remaining test failures with patched test_imagecodecs.py and patched zarr 3.0.1:
The
pglzcodec tests hang.cgohlke commentedon Jan 20, 2025
The test failures and hangs with patched Zarr 3 are fixed by:
cgohlke commentedon Jan 20, 2025
The imagecodecs doctests fail with Zarr 3 due to tifffile's Zarr stores not being compatible (but that's an entirely other issue).
QuLogic commentedon Jan 21, 2025
I only meant Zarr 3 the library, not Zarr 3 the file format. Sorry if that was unclear.
I've made roughly the same changes, and it's good to see that that full test suite is not that far off from what Fedora runs. The only one I didn't see was the
pglzhang. However, I did make the changes in a way as to reduce copies. I can open a PR to review if you want.And this one I didn't see; I suppose that Fedora doesn't run doctests.
cgohlke commentedon Jan 21, 2025
Sure. Thank you.
cgohlke commentedon Jan 21, 2025
Don't worry. It's just to make sure the examples are actually executable:
imagecodecs/imagecodecs/imagecodecs.py
Lines 360 to 467 in 988af50
cgohlke commentedon Jan 21, 2025
This has now been fixed in the development version, except where Zarr provides int8 arrays as "buffer" contrary to Python/Cython norms of uint8.
raphaeljolivet commentedon Mar 31, 2026
Hi,
Any chance of having
imagecodecsintegrated in Zarr3 again and part of standard codecs ?I was expecting some standard wrappers from zarr 2 to zarr 3 codecs. I didn't find anything.
The climate and forecast community really needs good compression for physical data, like
JPEG2000.cgohlke commentedon Mar 31, 2026
Maybe I am misunderstanding something:
imagecodecswas never part ofzarr. Imagecodecs currently contains extranumcodecscompatible codec wrappers, which can be used with Zarr 3 andzarr_format=2. The next imagecodecs version will include native Zarr 3 codec wrappers (forzarr_format=3) for ~74 imagecodecs codecs. I can post the preliminary code here if you want to try it out.raphaeljolivet commentedon Apr 1, 2026
That's good news thanks.
In the meantime, I've written a generic adapter myself :
https://gist.github.com/raphaeljolivet/8430d2a84caa6da5c75deeecd927f9fc
cgohlke commentedon May 11, 2026
v2026.5.10 includes native Zarr 3 codecs
d-v-b commentedon Jul 17, 2026
thanks for this work @cgohlke, would you have any interest in writing up specs for these codecs over in zarr-extensions? This will make it much easier for multiple implementations to use the same codec. For example, there is an active PR for a jpeg codec, it might be useful to get your input based on your experience with the
imagecodecs_jpegcodec.fcollman commentedon Jul 18, 2026
I just wanted to plus one davis's comment above... i started trying to write something , but I don't feel terribly qualified and I wanted to make sure that it reflected the understanding of some of the actual implementors before opening a PR