Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies = [
"numcodecs-wasm-tthresh~=0.2.0",
"numcodecs-wasm-uniform-noise~=0.3.0",
"numcodecs-wasm-zfp~=0.5.1",
"numcodecs-wasm-zfp-classic~=0.3.1",
"numcodecs-wasm-zlib~=0.3.0",
"pandas~=2.2",
"scipy~=1.14",
Expand Down
12 changes: 11 additions & 1 deletion src/climatebenchpress/compressor/compressors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
__all__ = ["BitRound", "BitRoundPco", "Jpeg2000", "StochRound", "Sz3", "Tthresh", "Zfp"]
__all__ = [
"BitRound",
"BitRoundPco",
"Jpeg2000",
"StochRound",
"Sz3",
"Tthresh",
"Zfp",
"ZfpRound",
]

from . import abc as abc
from .bitround import BitRound
Expand All @@ -8,3 +17,4 @@
from .sz3 import Sz3
from .tthresh import Tthresh
from .zfp import Zfp
from .zfp_round import ZfpRound
6 changes: 4 additions & 2 deletions src/climatebenchpress/compressor/compressors/zfp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__all__ = ["Zfp"]

import numcodecs_wasm_zfp
import numcodecs_wasm_zfp_classic

from .abc import Compressor

Expand All @@ -19,4 +19,6 @@ class Zfp(Compressor):

@staticmethod
def abs_bound_codec(dtype, error_bound):
return numcodecs_wasm_zfp.Zfp(mode="fixed-accuracy", tolerance=error_bound)
return numcodecs_wasm_zfp_classic.ZfpClassic(
mode="fixed-accuracy", tolerance=error_bound
)
22 changes: 22 additions & 0 deletions src/climatebenchpress/compressor/compressors/zfp_round.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
__all__ = ["ZfpRound"]

import numcodecs_wasm_zfp

from .abc import Compressor


class ZfpRound(Compressor):
name = "zfp-round"
description = "ZFP-ROUND"

# NOTE:
# ZFP mechanism for strictly supporting relative error bounds is to
# truncate the floating point bit representation and then use ZFP's lossless
# mode for compression. This is essentially equivalent to the BitRound
# compressors we are already implementing (with a difference what the lossless
# compression algorithm is).
# See https://zfp.readthedocs.io/en/release1.0.1/faq.html#q-relerr for more details.

@staticmethod
def abs_bound_codec(dtype, error_bound):
return numcodecs_wasm_zfp.Zfp(mode="fixed-accuracy", tolerance=error_bound)
Loading