-
-
Notifications
You must be signed in to change notification settings - Fork 366
Open
Labels
bugPotential issues with the zarr-python libraryPotential issues with the zarr-python library
Description
Zarr version
v3.1.3
Numcodecs version
0.16.3
Python Version
3.12
Operating System
Linux
Installation
uv
Description
Using pcodec with zarr results in
zarr.errors.UnknownCodecError: Unknown codec: 'zarr.codecs.numcodecs.PCodec'
Steps to reproduce
import xarray as xr
import numpy as np
from numcodecs.zarr3 import PCodec
# Create a sample xarray dataset
data = np.random.rand(10, 20)
lat = np.arange(10)
lon = np.arange(20)
ds = xr.Dataset(
{'my_variable': (('lat', 'lon'), data)},
coords={'lat': lat, 'lon': lon}
)
# Define the pcodec compressor
compressor = PCodec()
# Specify the encoding for the data variables
encoding = {'my_variable': {'serializer': compressor}}
# Save the dataset to a zarr store
output_zarr_path = '/tmp/my_xarray_pcodec.zarr'
ds.to_zarr(output_zarr_path, mode='w', encoding=encoding, zarr_version=3)Additional output
No response
Metadata
Metadata
Assignees
Labels
bugPotential issues with the zarr-python libraryPotential issues with the zarr-python library