numcodecs
zarr.codecs.numcodecs ¶
__all__
module-attribute
¶
__all__ = [
"BZ2",
"CRC32",
"CRC32C",
"LZ4",
"LZMA",
"ZFPY",
"Adler32",
"AsType",
"BitRound",
"Blosc",
"Delta",
"FixedScaleOffset",
"Fletcher32",
"GZip",
"JenkinsLookup3",
"PCodec",
"PackBits",
"Quantize",
"Shuffle",
"Zlib",
"Zstd",
"_NumcodecsArrayArrayCodec",
"_NumcodecsArrayBytesCodec",
"_NumcodecsBytesBytesCodec",
"_NumcodecsCodec",
]
Adler32
dataclass
¶
Bases: _NumcodecsChecksumCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
AsType
dataclass
¶
Bases: _NumcodecsArrayArrayCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> AsType
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/codecs/numcodecs/_codecs.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
BZ2
dataclass
¶
Bases: _NumcodecsBytesBytesCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
BitRound
dataclass
¶
Bases: _NumcodecsArrayArrayCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
Blosc
dataclass
¶
Bases: _NumcodecsBytesBytesCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
CRC32
dataclass
¶
Bases: _NumcodecsChecksumCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
CRC32C
dataclass
¶
Bases: _NumcodecsChecksumCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
Delta
dataclass
¶
Bases: _NumcodecsArrayArrayCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/codecs/numcodecs/_codecs.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
FixedScaleOffset
dataclass
¶
Bases: _NumcodecsArrayArrayCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(
array_spec: ArraySpec,
) -> FixedScaleOffset
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/codecs/numcodecs/_codecs.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/codecs/numcodecs/_codecs.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
Fletcher32
dataclass
¶
Bases: _NumcodecsChecksumCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
GZip
dataclass
¶
Bases: _NumcodecsBytesBytesCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
JenkinsLookup3
dataclass
¶
Bases: _NumcodecsChecksumCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
LZ4
dataclass
¶
Bases: _NumcodecsBytesBytesCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
LZMA
dataclass
¶
Bases: _NumcodecsBytesBytesCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
PCodec
dataclass
¶
Bases: _NumcodecsArrayBytesCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
PackBits
dataclass
¶
Bases: _NumcodecsArrayArrayCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
to_dict ¶
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 ¶
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/codecs/numcodecs/_codecs.py
Quantize ¶
Bases: _NumcodecsArrayArrayCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Quantize
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
Shuffle
dataclass
¶
Bases: _NumcodecsBytesBytesCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Shuffle
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/codecs/numcodecs/_codecs.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
ZFPY
dataclass
¶
Bases: _NumcodecsArrayBytesCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
Zlib
dataclass
¶
Bases: _NumcodecsBytesBytesCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata
Source code in zarr/abc/codec.py
Zstd
dataclass
¶
Bases: _NumcodecsBytesBytesCodec
Source code in zarr/codecs/numcodecs/_codecs.py
__init__ ¶
__init_subclass__ ¶
To be used only when creating the actual public-facing codec class.
Source code in zarr/codecs/numcodecs/_codecs.py
compute_encoded_size ¶
decode
async
¶
Decodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CodecOutput | None, ArraySpec]]) –Ordered set of encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CI | None]–
Source code in zarr/abc/codec.py
encode
async
¶
Encodes a batch of chunks. Chunks can be None in which case they are ignored by the codec.
Parameters:
-
chunks_and_specs(Iterable[tuple[CI | None, ArraySpec]]) –Ordered set of to-be-encoded chunks with their accompanying chunk spec.
Returns:
-
Iterable[CodecOutput | None]–
Source code in zarr/abc/codec.py
evolve_from_array_spec ¶
evolve_from_array_spec(array_spec: ArraySpec) -> Self
Fills in codec configuration parameters that can be automatically inferred from the array metadata.
Parameters:
-
array_spec(ArraySpec) –
Returns:
-
Self–
Source code in zarr/abc/codec.py
from_dict
classmethod
¶
resolve_metadata ¶
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_spec(ArraySpec) –
Returns:
-
ArraySpec–
Source code in zarr/abc/codec.py
to_dict ¶
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 ¶
validate(
*,
shape: tuple[int, ...],
dtype: ZDType[TBaseDType, TBaseScalar],
chunk_grid: ChunkGridMetadata,
) -> None
Validates that the codec configuration is compatible with the array metadata. Raises errors when the codec configuration is not compatible.
Parameters:
-
shape(tuple[int, ...]) –The array shape
-
dtype(dtype[Any]) –The array data type
-
chunk_grid(ChunkGridMetadata) –The array chunk grid metadata