ClipCodec for the numcodecs buffer compression API.
The ClipCodec is a filter codec: encoding passes the data through unchanged, decoding clips every value into the [minimum, maximum] range. Clipping never increases the error of a decoded value whose original value lies within the range, so the codec can be used to restore known data limits (e.g. non-negativity) after lossy compression:
from numcodecs_clip import ClipCodec
from numcodecs_combinators.stack import CodecStack
codec = CodecStack(
ClipCodec(minimum=0.0, maximum=1.0),
# ... any lossy codec ...
)Licensed under the Mozilla Public License, Version 2.0 (LICENSE or https://www.mozilla.org/en-US/MPL/2.0/).
The numcodecs-clip package has been developed as part of ESiWACE3, the third phase of the Centre of Excellence in Simulation of Weather and Climate in Europe.
Funded by the European Union. This work has received funding from the European High Performance Computing Joint Undertaking (JU) under grant agreement No 101093054.