Search code examples
pythonhdf5

Is there in python a single function that shows the full structure of a .hdf5 file?


When opening a .hdf5 file, one can explore the levels, keys and names of the file in different ways. I wonder if there is a way or a function that displays all the available paths to explore in the .hdf5. Ultimately showing the whole tree.


Solution

  • Try using nexuformat package to list the structure of the hdf5 file.

    Install by pip install nexusformat

    Code

    import nexusformat.nexus as nx
    f = nx.nxload(‘myhdf5file.hdf5’)
    print(f.tree)
    

    This should print the entire structure of the file. For more on that see this thread. Examples can be found here