This example demonstrates how to extend Zarr Python by defining a new data type.
The example shows how to:
- Define a custom
ZDTypeclass for theint2data type fromml_dtypes - Implement all required methods for serialization and deserialization
- Register the custom data type with Zarr's registry
- Create and use arrays with the custom data type in both Zarr v2 and v3 formats
python examples/custom_dtype/custom_dtype.pyOr run with uv:
uv run examples/custom_dtype/custom_dtype.py