numcodecs_mask
numcodecs_mask
Masking codecs for the numcodecs buffer compression API.
Classes:
-
MaskMetaCodec–Meta-codec that masks a value during encoding and restores it during decoding.
MaskMetaCodec
Bases: Codec, CodecCombinatorMixin
Meta-codec that masks a value during encoding and restores it during decoding.
The data is encoded with the codec, the boolean mask of
where values need to be restored is encoded with the bitmap_codec.
Multiple MaskMetaCodecs can be nested to mask several values.
The masked value can be replaced with a fill value before further encoding
by including a
numcodecs_replace.ReplaceFilterCodec
in the codec, e.g. by stacking using the
numcodecs-combinators
package.
| Parameters: |
|
|---|
Methods:
-
encode–Encode the data in
buf. -
decode–Decode the data in
buf. -
get_config–Returns the configuration of this mask meta-codec.
-
map–Apply the
mapperto this mask meta-codec.
encode
encode(buf: Buffer) -> Buffer
Encode the data in buf.
| Parameters: |
|
|---|
| Returns: |
|
|---|
decode
decode(buf: Buffer, out: None | Buffer = None) -> Buffer
Decode the data in buf.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_config
get_config() -> dict
Returns the configuration of this mask meta-codec.
numcodecs.registry.get_codec(config)
can be used to reconstruct this codec from the returned config.
| Returns: |
|
|---|
map
map(mapper: Callable[[Codec], Codec]) -> MaskMetaCodec
Apply the mapper to this mask meta-codec.
In the returned MaskMetaCodec, the codec and
bitmap_codec are replaced by their mapped codecs.
The mapper should recursively apply itself to any inner codecs that
also implement the
CodecCombinatorMixin
mixin.
To automatically handle the recursive application as a caller, you can use
numcodecs_combinators.map_codec(codec, mapper)
| Parameters: |
|---|
| Returns: |
|
|---|