zarr.codecs.numcodecs#
Classes#
Base class for bytes-to-bytes codecs. |
|
Base class for array-to-array codecs. |
|
Base class for bytes-to-bytes codecs. |
|
Base class for array-to-array codecs. |
|
Base class for bytes-to-bytes codecs. |
|
Base class for bytes-to-bytes codecs. |
|
Base class for bytes-to-bytes codecs. |
|
Base class for array-to-array codecs. |
|
Base class for array-to-array codecs. |
|
Base class for bytes-to-bytes codecs. |
|
Base class for bytes-to-bytes codecs. |
|
Base class for bytes-to-bytes codecs. |
|
Base class for bytes-to-bytes codecs. |
|
Base class for bytes-to-bytes codecs. |
|
Base class for array-to-bytes codecs. |
|
Base class for array-to-array codecs. |
|
Base class for array-to-array codecs. |
|
Base class for bytes-to-bytes codecs. |
|
Base class for array-to-bytes codecs. |
|
Base class for bytes-to-bytes codecs. |
|
Base class for bytes-to-bytes codecs. |
Package Contents#
- class zarr.codecs.numcodecs.Adler32(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsChecksumCodecBase class for bytes-to-bytes codecs.
- compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.AsType(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsArrayArrayCodecBase class for array-to-array codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) AsType[source]#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.BZ2(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsBytesBytesCodecBase class for bytes-to-bytes codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.BitRound(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsArrayArrayCodecBase class for array-to-array codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.Blosc(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsBytesBytesCodecBase class for bytes-to-bytes codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.CRC32(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsChecksumCodecBase class for bytes-to-bytes codecs.
- compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.CRC32C(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsChecksumCodecBase class for bytes-to-bytes codecs.
- compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.Delta(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsArrayArrayCodecBase class for array-to-array codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.FixedScaleOffset(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsArrayArrayCodecBase class for array-to-array codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(
- array_spec: zarr.core.array_spec.ArraySpec,
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.Fletcher32(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsChecksumCodecBase class for bytes-to-bytes codecs.
- compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.GZip(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsBytesBytesCodecBase class for bytes-to-bytes codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.JenkinsLookup3(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsChecksumCodecBase class for bytes-to-bytes codecs.
- compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.LZ4(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsBytesBytesCodecBase class for bytes-to-bytes codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.LZMA(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsBytesBytesCodecBase class for bytes-to-bytes codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.PCodec(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsArrayBytesCodecBase class for array-to-bytes codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.PackBits(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsArrayArrayCodecBase class for array-to-array codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(*, dtype: zarr.dtype.ZDType[Any, Any], **_kwargs: Any) None[source]#
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.Quantize(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsArrayArrayCodecBase class for array-to-array codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Quantize[source]#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.Shuffle(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsBytesBytesCodecBase class for bytes-to-bytes codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Shuffle[source]#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.ZFPY(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsArrayBytesCodecBase class for array-to-bytes codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.Zlib(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsBytesBytesCodecBase class for bytes-to-bytes codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#
- class zarr.codecs.numcodecs.Zstd(**codec_config: zarr.core.common.JSON)[source]#
Bases:
_NumcodecsBytesBytesCodecBase class for bytes-to-bytes codecs.
- abstractmethod compute_encoded_size(
- input_byte_length: int,
- chunk_spec: zarr.core.array_spec.ArraySpec,
Given an input byte length, this method returns the output byte length. Raises a NotImplementedError for codecs with variable-sized outputs (e.g. compressors).
- Parameters:
- input_byte_lengthint
- chunk_specArraySpec
- Returns:
- int
- async decode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecOutput | None, zarr.core.array_spec.ArraySpec]],
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecOutput | None, ArraySpec]]
Ordered set of encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecInput | None]
- async encode(
- chunks_and_specs: collections.abc.Iterable[tuple[CodecInput | None, zarr.core.array_spec.ArraySpec]],
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
- Parameters:
- chunks_and_specsIterable[tuple[CodecInput | None, ArraySpec]]
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
- Returns:
- Iterable[CodecOutput | None]
- evolve_from_array_spec(array_spec: zarr.core.array_spec.ArraySpec) Self#
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
- Parameters:
- array_specArraySpec
- Returns:
- Self
- classmethod from_dict(data: dict[str, zarr.core.common.JSON]) Self#
Create an instance of the model from a dictionary
- resolve_metadata(
- chunk_spec: zarr.core.array_spec.ArraySpec,
Computed the spec of the chunk after it has been encoded by the codec. This is important for codecs that change the shape, data type or fill value of a chunk. The spec will then be used for subsequent codecs in the pipeline.
- Parameters:
- chunk_specArraySpec
- Returns:
- ArraySpec
- to_dict() dict[str, zarr.core.common.JSON]#
Recursively serialize this model to a dictionary. This method inspects the fields of self and calls x.to_dict() for any fields that are instances of Metadata. Sequences of Metadata are similarly recursed into, and the output of that recursion is collected in a list.
- validate(
- *,
- shape: tuple[int, Ellipsis],
- dtype: zarr.core.dtype.wrapper.ZDType[zarr.core.dtype.wrapper.TBaseDType, zarr.core.dtype.wrapper.TBaseScalar],
- chunk_grid: zarr.core.chunk_grids.ChunkGrid,
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
- Parameters:
- shapetuple[int, …]
The array shape
- dtypenp.dtype[Any]
The array data type
- chunk_gridChunkGrid
The array chunk grid
- codec_config: dict[str, zarr.core.common.JSON]#
- codec_name: str#
- is_fixed_size: bool#