I realize that HDF5 is a self describing format, and I can use a tool or programmatically find out what types of data groups exist in an HDF5 file.

What I am really looking for are the group and data set names created by HEC-RAS in the pxx and hxx file types. This information does not appear to be documented on the HEC-RAS web site or in the numerous manuals the group publishes.

1 Answer 1


You can use h5py python package to examine .h5 file structure. The following script prints out the structure of any .h5 file.

import h5py

def print_h5_structure(f, level=0):
    """    prints structure of hdf5 file    """
    for key in f.keys():
        if isinstance(f[key], h5py._hl.dataset.Dataset):
            print(f"{'  '*level} DATASET: {f[key].name}")
        elif isinstance(f[key], h5py._hl.group.Group):
            print(f"{'  '*level} GROUP: {key, f[key].name}")
            level += 1
            print_h5_structure(f[key], level)
            level -= 1

        if f[key].parent.name == "/":

file_path = "path/to/file.h5"
f = h5py.File(file_path, 'r')


Sample .h5 file output:

GROUP: ('BEAM0000', '/BEAM0000')
  DATASET: /BEAM0000/all_samples_sum
  GROUP: ('ancillary', '/BEAM0000/ancillary')
    DATASET: /BEAM0000/ancillary/master_time_epoch
    DATASET: /BEAM0000/ancillary/mean_samples
    DATASET: /BEAM0000/ancillary/smoothing_width
  DATASET: /BEAM0000/beam
  DATASET: /BEAM0000/channel
  DATASET: /BEAM0000/delta_time
  GROUP: ('geolocation', '/BEAM0000/geolocation')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.