Zarr version
v3.0.1
Numcodecs version
15.0
Python Version
3.12.8
Operating System
MacOs
Installation
conda
Description
Hi
I'm Loving Zarr v3 :) - thanks.
I'm trying ot use zarr 3 to create zarr 2 format Zarr's, via xarrray.
i'm using a numcodecs compressor (PCodec), and left the code in "zarr 3 style". - i.e. imported numcodecs.zarr3.PCodec
using this setup, zarr allows me to write the array in zarr 2 format, but when I try to read it, I get an error:
ImportError: zarr 3.0.0 or later is required to use the numcodecs zarr integration
I think zarr 3 should have some firewalling in to ensure that it only allows zarr 2 compatable compressors if writing a zarr2 array.
If I import numcodecs.PCodec instead (while still using zarr3, but writing zarr_format as 2, everything works fine)
Steps to reproduce
zarr creation code below (run using zarr 3.0.1:
import zarr
import xarray
import numcodecs.zarr3 as numcodecsz3
#Open the zarr (any zarr should work here - just set "test_band_ below to a band from the zarr you are using)
ds = xarray.open_zarr('./hls_20200101_20201231_99cc_50q', consolidated=True)
# We want to write the DataSet with different encodings than the source, therefore
# clear all encoding config first.
ds = ds.drop_encoding()
encoding = {}
encoding['test_band'] = {"serializer": numcodecsz3.PCodec(level=5)}
ds.to_zarr('./test2', mode="w", encoding = encoding, zarr_format=2)
read code:
(using latest version of zarr 2)
import zarr
import xarray
import numcodecs.zarr3 as numcodecsz3
# Open file
z2 = zarr.open('test2', mode='r')
print(z2['ndvi'][:])
Additional output
No response
Zarr version
v3.0.1
Numcodecs version
15.0
Python Version
3.12.8
Operating System
MacOs
Installation
conda
Description
Hi
I'm Loving Zarr v3 :) - thanks.
I'm trying ot use zarr 3 to create zarr 2 format Zarr's, via xarrray.
i'm using a numcodecs compressor (PCodec), and left the code in "zarr 3 style". - i.e. imported numcodecs.zarr3.PCodec
using this setup, zarr allows me to write the array in zarr 2 format, but when I try to read it, I get an error:
ImportError: zarr 3.0.0 or later is required to use the numcodecs zarr integration
I think zarr 3 should have some firewalling in to ensure that it only allows zarr 2 compatable compressors if writing a zarr2 array.
If I import numcodecs.PCodec instead (while still using zarr3, but writing zarr_format as 2, everything works fine)
Steps to reproduce
zarr creation code below (run using zarr 3.0.1:
read code:
(using latest version of zarr 2)
Additional output
No response