Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Default: 0 (for about 8kB per block).
:param bool lz4:
Whether to use LZ4_ID compression or not as part of the filter.
Default: True
"""
filter_id = BSHUF_ID
def __init__(self, nelems=0, lz4=True):
nelems = int(nelems)
assert nelems % 8 == 0
lz4_enabled = 2 if lz4 else 0
self.filter_options = (nelems, lz4_enabled)
class LZ4(_FilterRefClass):
"""h5py.Group.create_dataset's compression and compression_opts arguments for using lz4 filter.
:param int nelems:
The number of bytes per block.
Default: 0 (for 1GB per block).
"""
filter_id = LZ4_ID
def __init__(self, nbytes=0):
nbytes = int(nbytes)
assert 0 <= nbytes <= 0x7E000000
self.filter_options = (nbytes,)
def _init_filters():
"""Initialise and register HDF5 filters with h5py
}
def __hash__(self):
return hash((self.filter_id, self.filter_options))
def __len__(self):
return len(self._kwargs)
def __iter__(self):
return iter(self._kwargs)
def __getitem__(self, item):
return self._kwargs[item]
class Blosc(_FilterRefClass):
"""h5py.Group.create_dataset's compression and compression_opts arguments for using blosc filter.
:param str cname:
`blosclz`, `lz4` (default), `lz4hc`, `zlib`, `zstd`
Optional: `snappy`, depending on compilation (requires C++11).
:param int clevel:
Compression level from 0 no compression to 9 maximum compression.
Default: 5.
:param int shuffle: One of:
- Blosc.NOSHUFFLE (0): No shuffle
- Blosc.SHUFFLE (1): byte-wise shuffle (default)
- Blosc.BITSHUFFLE (2): bit-wise shuffle
"""
NOSHUFFLE = 0
"""Flag to disable data shuffle pre-compression filter"""
'lz4': 1,
'lz4hc': 2,
'snappy': 3,
'zlib': 4,
'zstd': 5,
}
def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE):
compression = self.__COMPRESSIONS[cname]
clevel = int(clevel)
assert 0 <= clevel <= 9
assert shuffle in (self.NOSHUFFLE, self.SHUFFLE, self.BITSHUFFLE)
self.filter_options = (0, 0, 0, 0, clevel, shuffle, compression)
class Bitshuffle(_FilterRefClass):
"""h5py.Group.create_dataset's compression and compression_opts arguments for using bitshuffle filter.
:param int nelems:
The number of elements per block.
Default: 0 (for about 8kB per block).
:param bool lz4:
Whether to use LZ4_ID compression or not as part of the filter.
Default: True
"""
filter_id = BSHUF_ID
def __init__(self, nelems=0, lz4=True):
nelems = int(nelems)
assert nelems % 8 == 0
lz4_enabled = 2 if lz4 else 0