ngff_zarr.codecsΒΆ

Compression codec utilities for ngff-zarr.

Provides a shared interface for translating human-readable codec names (e.g. "gzip", "blosc:zstd") into numcodecs compressor objects that can be passed to :func:~ngff_zarr.to_ngff_zarr via its compressor keyword argument.

The same helpers are used by the CLI (--codec), the MCP server, and can be called directly by library consumers.

Module ContentsΒΆ

FunctionsΒΆ

get_available_codecs

Return the list of supported compression codec names.

codec_from_name

Convert a codec name string to a numcodecs compressor object.

APIΒΆ

ngff_zarr.codecs.get_available_codecs() list[str]ΒΆ

Return the list of supported compression codec names.

Always includes "none", "gzip", "lz4", and "zstd". When numcodecs is installed the blosc family is appended: "blosc", "blosc:blosclz", "blosc:lz4", "blosc:lz4hc", "blosc:snappy", "blosc:zlib", "blosc:zstd".

ngff_zarr.codecs.codec_from_name(name: str, level: int | None = None) AnyΒΆ

Convert a codec name string to a numcodecs compressor object.

Parameters

name : str One of the names returned by :func:get_available_codecs. "none" explicitly disables compression (returns None). level : int, optional Compression level. When omitted a sensible default is used for the chosen codec (gzip=6, zstd=3, blosc=5).

Returns

compressor A numcodecs compressor instance, or None when name is "none".

Raises

ValueError If name is not recognised.