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
importxarrayasxrimportnumpyasnpfromnumcodecs.zarr3importPCodec# Create a sample xarray datasetdata=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 compressorcompressor=PCodec()
# Specify the encoding for the data variablesencoding= {'my_variable': {'serializer': compressor}}
# Save the dataset to a zarr storeoutput_zarr_path='/tmp/my_xarray_pcodec.zarr'ds.to_zarr(output_zarr_path, mode='w', encoding=encoding, zarr_version=3)
Activity
d-v-b commentedon Oct 27, 2026
the zarr3 module is gone and pcodec should work as a normal numcodecs codec. closing.