Non/broken HDF5 input files need better diagnosis
texadactyl opened this issue · comments
Richard Elkins commented
The issue is in hdf_reader.py. This is a terrible way of finding out that you have a bogus HDF5 file:
Traceback (most recent call last):
File "header_reader.py", line 10, in <module>
fb = bl.Waterfall(file)
File "/home/ssheikh/.local/lib/python3.7/site-packages/blimpy/waterfall.py", line 100, in __init__
load_data=load_data, max_load=max_load)
File "/home/ssheikh/.local/lib/python3.7/site-packages/blimpy/io/file_wrapper.py", line 47, in open_file
load_data=load_data, max_load=max_load)
File "/home/ssheikh/.local/lib/python3.7/site-packages/blimpy/io/hdf_reader.py", line 44, in __init__
self.n_channels_in_file = self.h5["data"].shape[self.freq_axis] #
IndexError: tuple index out of range
There should be a precise diagnostic message describing the actual issue.
Richard Elkins commented
Combine logic of hdf_reader.py and h5diag into a single function inserted into hdf_reader.py.
Richard Elkins commented
Found another case where all of the HDF5 elements except "data" were ok. The data was the correct shape. But, the supporting B-tree is corrupt.
File: /datag/lacker/broken/blc01_guppi_59411_44033_NGC1400_0057.rawspec.0000.h5
in the UCB data centre.
Very useful test case, @lacker