numcodecs_delta

numcodecs_delta

Delta codecs for the numcodecs buffer compression API.

Classes:

  • BinaryDeltaCodec

    Codec to encode the data as the binary difference between adjacent values.

BinaryDeltaCodec

Bases: Codec

Codec to encode the data as the binary difference between adjacent values.

The encoded data has the same data type as the input, but its bits represent the binary difference between values. If the input data is floating point, these difference values may have weird values that are of little use arithmetically. Despite this weird representation, this codec is able to losslessly reconstruct all values.

It is recommended to only use lossless encodings after this codec.

Please refer to the numcodecs.delta.Delta codec for a delta codec that computes the difference in the data type as the input.

Methods:

  • encode

    Encode the data in buf.

  • decode

    Decode the data in buf.

codec_id class-attribute instance-attribute

codec_id: str = 'delta.binary'

encode

encode(buf: Buffer) -> Buffer

Encode the data in buf.

Parameters:
  • buf (Buffer) –

    Data to be encoded. May be any object supporting the new-style buffer protocol.

Returns:
  • enc( Buffer ) –

    Encoded data. May be any object supporting the new-style buffer protocol.

decode

decode(buf: Buffer, out: None | Buffer = None) -> Buffer

Decode the data in buf.

Parameters:
  • buf (Buffer) –

    Encoded data. May be any object supporting the new-style buffer protocol.

  • out (Buffer, default: None ) –

    Writeable buffer to store decoded data. N.B. if provided, this buffer must be exactly the right size to store the decoded data.

Returns:
  • dec( Buffer ) –

    Decoded data. May be any object supporting the new-style buffer protocol.