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
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".
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.
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
The text was updated successfully, but these errors were encountered:
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".
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.
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
The text was updated successfully, but these errors were encountered: