Inspecting the File content#

To get an overview of the file content, a tree-view representation is provided. It can be called using .dump(). This, however, is only possible in notebooks. Outside of it (e.g. in a normal python console) call .sdump() (string-dump) to get a “raw”, non-interactive, tree view.

However, we are in a notebook environment here, so let’s use dump():

import h5rdmtoolbox as h5tbx
from h5rdmtoolbox import tutorial

# get some example files:
list_of_hdf_filenames = tutorial.Database.generate_test_files()

# dump the content of the first file in the list:
with h5tbx.File(list_of_hdf_filenames[0]) as h5:
    h5.dump()
Failed to import module h5tbx
    • __db_file_type__ : piv_case
    • contact_person : John
      (2, 5, 64, x: 86, 2) [float32]
      • long_name : u-component
      • units : m/s
      (2, 5, 64, x: 86, 2) [float32]
      • long_name : v-component
      • units : m/s
      (86) [int32]
      • long_name : x-coordinate
      • units : m
      • long_name : time averaged data
        (2, 64, 86, 2) [float32]
        • long_name : mean u-component
        • units : m/s
        (2, 64, 86, 2) [float32]
        • long_name : mean v-component
        • units : m/s

User-defined representation#

Every convention that is selected may have a different way of displaying the content. For the built-in convention “h5tbx”, the attribute “units” is put in square brackets behind the dataset name and thus is not listed as an attribute:

h5tbx.use('h5tbx')

with h5tbx.File(list_of_hdf_filenames[0]) as h5:
    h5.dump()
    • __db_file_type__ : piv_case
    • contact_person : John
      (2, 5, 64, x: 86, 2) [float32]
      • long_name : u-component
      • units : m/s
      (2, 5, 64, x: 86, 2) [float32]
      • long_name : v-component
      • units : m/s
      (86) [int32]
      • long_name : x-coordinate
      • units : m
      • long_name : time averaged data
        (2, 64, 86, 2) [float32]
        • long_name : mean u-component
        • units : m/s
        (2, 64, 86, 2) [float32]
        • long_name : mean v-component
        • units : m/s