European-XFEL / h5glance

Explore HDF5 files in terminal & HTML views
BSD 3-Clause "New" or "Revised" License
68 stars 8 forks source link

H5Glance lets you explore HDF5 files in the terminal or an HTML interface.

Install it with::

pip install h5glance

In the terminal, you can get a tree view of a file::

$ h5glance sample.h5
sample.h5
└path
  └inside
    └file   [float64: 100 × 100]

The names of datasets, groups and links are colour-coded by default. If you want to disable this, set the environment variable H5GLANCE_COLORS=0. H5Glance also respects the NO_COLOR convention <https://no-color.org/>_.

Inspect a group or dataset inside it::

$ h5glance sample.h5 path/inside/file
sample.h5/path/inside/file
      dtype: float64
      shape: 100 × 100
   maxshape: 100 × 100
     layout: Contiguous

sample data:
[[-0.27756437  0.36923643 -0.28113527 ...

In bash & zsh, h5glance offers tab-completion for the paths inside HDF5 files. To set this up, run::

python -m h5glance.completer

Alternatively, use - as the second argument, and h5glance will prompt you for the object path with tab completion::

$ h5glance sample.h5 -
Object path: sample.h5/  # try tapping tab

HTML interface

The HTML interface lets you inspect HDF5 files in a Jupyter Notebook. Demo.ipynb <https://nbviewer.jupyter.org/github/European-XFEL/h5glance/blob/master/Demo.ipynb>_ shows how to use it.

Why H5Glance?

There are plenty of other tools to view HDF5 files, including HDFView <https://www.hdfgroup.org/downloads/hdfview/> and ViTables <https://vitables.org/>, as well as various web-based viewers in development. Why might you choose H5Glance?

Some things it's not designed for: