Add helper function and class methods to create filter instance from hdf5 "cd_values"#366
Add helper function and class methods to create filter instance from hdf5 "cd_values"#366t20100 merged 14 commits intosilx-kit:mainfrom
Conversation
|
As it is, reading hdf5 filter option works for the currently embedded version of the compression filters. Same for endianness checks, let's do it in a separate PR. |
payno
left a comment
There was a problem hiding this comment.
I though I catch some byte operation error at one point... but no 😇
Thanks for the unit test :)
| :raises ValueError: Unsupported filter_options | ||
| :raises NotImplementedError: Support of filter_options version is not implemented | ||
| """ | ||
| # ZFP header parsing reference: |
There was a problem hiding this comment.
I hope those won't be changed to much other time. Should it be part of the documentation ?
There was a problem hiding this comment.
Except for compilation warning, those C functions didn't changed since ZFP
v0.5.5 7 years ago and which is the first version of ZFP used by hdf5plugin.
So I would say it's quite stable.
See:
| self.filter_options = (0, 0, 0, 0, clevel, shuffle, compression) | ||
|
|
||
| @classmethod | ||
| def _from_filter_options(cls, filter_options: tuple[int, ...]) -> Blosc: |
There was a problem hiding this comment.
Maybe those could be a use case for match...
But I think no much people are using them and this could be more confusing than something else
There was a problem hiding this comment.
I propose to keep it with common chained if for this PR, we can eventually rework this after.
Co-authored-by: payno <payno@users.noreply.github.com>
This PR adds helpers to instantiate filter class from
cd_valuesfor each filter (only tested for Bitshuffle and Blosc so far)- [ ] Check endianness issues with filter packing double or bits: Sperr, SZ, SZ3, ZFP- [ ] Check which versions of the filter are supported and raise an exception for unsupported version if the version is stored in thecd_valuesUsage:
Related to #365