HDF5 Notes

Table of Contents

Overview

Install and Test

Ubuntu

$ sudo apt-get install libhdf5-serial-dev
# The MPI version with C and Fortran interfaces
$ sudo apt-get install libhdf5-mpich-dev

Compile and install with CMake from source codes

  1. download CMake-hdf5-1.8.16.tar.gz https://www.hdfgroup.org/HDF5/release/cmakebuild.html
  2. Build
    ./build-unix.sh
    ...
    ...
    1978/1979 Test #1895: PERFORM_iopipe ............................................   Passed    8.34 sec
    1979/1979 Test  #42: H5TEST-fheap ..............................................   Passed   72.96 sec
    
    100% tests passed, 0 tests failed out of 1979
    
    Total Test time (real) =  93.46 sec
    

Test Example

The SDS.h5 is in a compressed binary format, which means that it can not be read directly. However there exists a bunch of HDF5 utilities (external programs) that allows humans to see what is contained in the files:

cd ./build/bin
./h5dump ../examples/SDS.h5 
HDF5 "../examples/SDS.h5" {
GROUP "/" {
   DATASET "IntArray" {
      DATATYPE  H5T_STD_I32LE
      DATASPACE  SIMPLE { ( 5, 6 ) / ( 5, 6 ) }
      DATA {
      (0,0): 0, 1, 2, 3, 4, 5,
      (1,0): 1, 2, 3, 4, 5, 6,
      (2,0): 2, 3, 4, 5, 6, 7,
      (3,0): 3, 4, 5, 6, 7, 8,
      (4,0): 4, 5, 6, 7, 8, 9
      }
   }
}
}

Inspection Tools

Note that last quoted code is not the real content of the file but just a human readable translation, that was accessed by means of one of the tools installed in ~/usr/bin. There are even graphical programs to visualize the contents of HDF5 file. These programs that read HDF5 have the advantage that they do not load the data into memory. You can inspect the contents of a 40GB file without hanging the system.

HDFVie

The official viewer is HDFView.

cd ~/soft
wget http://www.hdfgroup.org/ftp/HDF5/hdf-java/hdfview/hdfview_install_linux32.bin
sudo sh ./hdfview_install_linux32.bin
/usr/local/hdfveiw/bin/hdfview.sh

ViTables

An alternative program is ViTables.

sudo apt-get install python-tables python-qt4
cd ~/soft
wget http://download.berlios.de/vitables/ViTables-2.0.tar.gz
tar -zxvf ViTables-2.0.tar.gz
cd ViTables-2.0
sudo python setup.py install
vitables

More

Author: Shi Shougang

Created: 2016-03-15 Tue 21:18

Emacs 24.3.1 (Org mode 8.2.10)

Validate