Thursday, February 12, 2015

HDF5 get mode and header


##########################################################
#example:
#
#$ getmode U.V1 31,31,15
#
#      (31,31,15): {
#            0.000210922,
#            -0.000870292
#         }
##########################################################
function getmode {
    h5dump -d /$1 -s "$2" -S "1,1,1" -c "1,1,1" -k "1,1,1" $1.h5 | sed -n '14,17p'
}
#########################################################
#example:
#
#$ getheader U.V1
#
#HDF5 "U.V1.h5" {
#GROUP "/" {
#   DATASET "U.V1" {
#      DATATYPE  H5T_COMPOUND {
#         H5T_IEEE_F32LE "real";
#         H5T_IEEE_F32LE "imag";
#      }
#      DATASPACE  SIMPLE { ( 32, 32, 17 ) / ( 32, 32, 17 ) }
#   }
#}
#}
##########################################################
function getheader {
    h5dump --header $1.h5
}

#Reference:
http://davis.lbl.gov/Manuals/HDF5-1.4.3/Tutor/util.html
http://stackoverflow.com/questions/6022384/bash-tool-to-get-nth-line-from-a-file 

No comments: