class numcodecs.bitround.BitRound(keepbits: int)[source]#

Floating-point bit rounding codec

Drops a specified number of bits from the floating point mantissa, leaving an array more amenable to compression. The number of bits to keep should be determined by an information analysis of the data to be compressed. The approach is based on the paper by Klöwer et al. 2021 ( See zarr-developers/numcodecs#298 for discussion and the original implementation in Julia referred to at milankl/BitInformation.jl

keepbits: int

The number of bits of the mantissa to keep. The range allowed depends on the dtype input data. If keepbits is equal to the maximum allowed for the data type, this is equivalent to no transform.

codec_id = 'bitround'#

Codec identifier.


Create int array by rounding floating-point data

The itemsize will be preserved, but the output should be much more compressible.

decode(buf, out=None)[source]#

Remake floats from ints

As with encode, preserves itemsize.


Return a dictionary holding configuration parameters for this codec. Must include an ‘id’ field with the codec identifier. All values must be compatible with JSON encoding.

classmethod from_config(config)#

Instantiate codec from a configuration object.