Skip to content

Commit

Permalink
C2Array sends metadata (like codec, filters, splitmode and tuner) as …
Browse files Browse the repository at this point in the history
…ints
  • Loading branch information
FrancescAlted committed Oct 11, 2024
1 parent 3da7003 commit ad13c17
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/blosc2/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,18 @@ class CParams:
tuner: blosc2.Tuner = blosc2.Tuner.STUNE

def __post_init__(self):
# C2Array sends metadata (like codec, filters, splitmode and tuner) as ints
if not isinstance(self.codec, blosc2.Codec):
with contextlib.suppress(ValueError):
# User-defined codecs may have no entries in Codec
self.codec = blosc2.Codec(self.codec)
if not isinstance(self.splitmode, blosc2.SplitMode):
with contextlib.suppress(ValueError):
self.splitmode = blosc2.SplitMode(self.splitmode)
if not isinstance(self.tuner, blosc2.Tuner):
with contextlib.suppress(ValueError):
self.tuner = blosc2.Tuner(self.tuner)

if len(self.filters) > 6:
raise ValueError("Number of filters exceeds 6")
if len(self.filters) < len(self.filters_meta):
Expand Down

0 comments on commit ad13c17

Please sign in to comment.