UCBerkeleySETI / blimpy

Breakthrough Listen I/O Methods for Python

Home Page:https://blimpy.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non/broken HDF5 input files need better diagnosis

texadactyl opened this issue · comments

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.

Combine logic of hdf_reader.py and h5diag into a single function inserted into hdf_reader.py.

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