Paul, Good suggestion. I entered an enhancement request.
Meanwhile if your file is simple enough (no region references, no external links, no multidimensional attributes) you may try the ncdump utility from the netCDF 4.1.3 release (http://www.unidata.ucar.edu/downloads/netcdf/index.jsp). But no guarantee.... Elena On Oct 22, 2011, at 3:54 AM, Paul Anton Letnes wrote: > Hi! > > I would like to ask whether it is possible to print the contents of a hdf5 > file in a more compact manner than h5dump does, and with attribute info, > which h5ls does not print. Let me show you an example of what I mean. > > The file example.h5 contains several datasets: > % h5ls -r example.h5 > / Group > /group Group > /group/d1 Dataset {10, 5} > /group/d2 Dataset {3} > /group/two Group > /group/two/d1 Dataset {10, 5} > /group/two/d2 Dataset {3} > > But I would like to also see the attributes, in some format or another. This > could, for example, look like this: > % h5ls --my-favorite-options example.h5 > / > /group/ > attributes: alpha = -3 > beta = "hello" > datasets: d1: float (10, 5) > d2: integer (3) > attributes: delta = "foo" > gamma = "bar" > /group/two > datasets: d1: float(10, 5) > d2: integer(3) > > Here, more information is given: the size and type of datasets as well as all > attributes. This makes it easier to decipher what the (meaning of the) file > contents are. > > h5dump -A example.h5 gives me all this information, but it is a tad too > verbose for human readability, in my opinion (see bottom of email). > > Is there a (combination of) flag(s) to h5dump or h5ls that will do this? If > not, it would be nice to get this feature, in order to more easily decipher > what a file's contents and structure are. I would be interested in helping > out myself, although it could be difficult to find time in the near future. > > Cheers > Paul > > > % h5dump -A example.h5 > HDF5 "example.h5" { > GROUP "/" { > GROUP "group" { > ATTRIBUTE "alpha" { > DATATYPE H5T_STD_I64LE > DATASPACE SCALAR > DATA { > (0): 3 > } > } > ATTRIBUTE "beta" { > DATATYPE H5T_STRING { > STRSIZE 5; > STRPAD H5T_STR_NULLPAD; > CSET H5T_CSET_ASCII; > CTYPE H5T_C_S1; > } > DATASPACE SCALAR > DATA { > (0): "hello" > } > } > DATASET "d1" { > DATATYPE H5T_STD_I64LE > DATASPACE SIMPLE { ( 10, 5 ) / ( 10, 5 ) } > } > DATASET "d2" { > DATATYPE H5T_STD_I64LE > DATASPACE SIMPLE { ( 3 ) / ( 3 ) } > ATTRIBUTE "delta" { > DATATYPE H5T_STRING { > STRSIZE 3; > STRPAD H5T_STR_NULLPAD; > CSET H5T_CSET_ASCII; > CTYPE H5T_C_S1; > } > DATASPACE SCALAR > DATA { > (0): "foo" > } > } > ATTRIBUTE "gamma" { > DATATYPE H5T_STRING { > STRSIZE 3; > STRPAD H5T_STR_NULLPAD; > CSET H5T_CSET_ASCII; > CTYPE H5T_C_S1; > } > DATASPACE SCALAR > DATA { > (0): "bar" > } > } > } > GROUP "two" { > DATASET "d1" { > DATATYPE H5T_STD_I64LE > DATASPACE SIMPLE { ( 10, 5 ) / ( 10, 5 ) } > } > DATASET "d2" { > DATATYPE H5T_STD_I64LE > DATASPACE SIMPLE { ( 3 ) / ( 3 ) } > } > } > } > } > } > _______________________________________________ > Hdf-forum is for HDF software users discussion. > [email protected] > http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org _______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
