I'm using h5py with LZF compression to store NumPy arrays in HDF5 files.
It works well, and my compressed files are much more portable than the uncompressed ones. However, if I try to view the compressed files using applications like vitables and HDFView, I get the following errors:
"Error: problems reading records. The dataset seems to be compressed with the None library. Check that it is installed in your system, please" in vitables and
"ncsa.hdf.hdf5lib.exceptions.HDF5Exception: ncsa.hdf.hdf5lib.exceptions.HDF5LibraryException: Can't open directory or file" in HDFView.
I can browse the file structures OK in both appications, but opening an array produces an error. If I turn off compression, the problem goes away. As an example, after running the code below, opening array_1 gives me the error, but array_2 doesn't.
import numpy as np, h5py
h5_path = r'D:\test.h5'
f = h5py.File(h5_path, 'w')
# Create fake data
data = (np.random.random(1E6)*100).astype(int)
# Save with compression
dset1 = f.create_dataset(r'/path/to/arrays/array_1', data=data,
compression='lzf')
# Save without compression
dset2 = f.create_dataset(r'/path/to/arrays/array_2', data=data)
# Set some object properties
dset1.attrs['Description'] = 'Compressed array.'
dset2.attrs['Description'] = 'Uncompressed array.'
f.close()
Is this behaviour expected, or am I doing something wrong?
If vitables and HDFView can't open compressed arrays, is there an alternative viewer that can?
Thanks very much!