| 1 |
import numpy |
| 2 |
import h5py |
| 3 |
import hdf5plugin |
| 4 |
|
| 5 |
compressors = dict( |
| 6 |
zstd=hdf5plugin.Zstd(), |
| 7 |
bitshuffle=hdf5plugin.Bitshuffle(nelems=0, cname="lz4"), |
| 8 |
lz4=hdf5plugin.LZ4(nbytes=0), |
| 9 |
blosc_lz4_bitshuffle=hdf5plugin.Blosc( |
| 10 |
cname="blosclz", clevel=9, shuffle=hdf5plugin.Blosc.BITSHUFFLE |
| 11 |
), |
| 12 |
) |
| 13 |
|
| 14 |
for c in compressors: |
| 15 |
f = h5py.File(f"hdf5_compression_{c}.h5", "w") |
| 16 |
# Explicit set int64, to keep compatible with Numpy 1.x in Windows |
| 17 |
f.create_dataset( |
| 18 |
"data", data=numpy.arange(100, dtype=numpy.int64), **compressors[c] |
| 19 |
) |
| 20 |
f.close() |