File: gen_hdf5.py

package info (click to toggle)
kerchunk 0.2.9-4
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 135,208 kB
  • sloc: python: 6,483; makefile: 32
file content (17 lines) | stat: -rw-r--r-- 469 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import numpy
import h5py
import hdf5plugin

compressors = dict(
    zstd=hdf5plugin.Zstd(),
    bitshuffle=hdf5plugin.Bitshuffle(nelems=0, cname="lz4"),
    lz4=hdf5plugin.LZ4(nbytes=0),
    blosc_lz4_bitshuffle=hdf5plugin.Blosc(
        cname="blosclz", clevel=9, shuffle=hdf5plugin.Blosc.BITSHUFFLE
    ),
)

for c in compressors:
    f = h5py.File(f"hdf5_compression_{c}.h5", "w")
    f.create_dataset("data", data=numpy.arange(100), **compressors[c])
    f.close()