写入数据:

1
2
3
4
import h5py

f = h5py.File('data.h5', 'w')
f.create_dataset('a', shape=(255, 1024, 768), dtype=np.uint8, chunks=(1, 1024, 768), data=a, compression='gzip', compression_opts=9)

读取数据

1
2
3
4
import h5py

f = h5py.File('data.h5', 'r')
a = f['a']