nws_tools.hdfburp

nws_tools.hdfburp(f)[source]

Pump out everything stored in a HDF5 container

Parameters:

f : h5py file object

File object created using h5py.File()

Returns:

Nothing : None

See also

h5py
a Pythonic interface to the HDF5 binary data format.

Notes

This function takes an h5py-file object and creates variables in the caller’s local name-space corresponding to the respective dataset-names in the file. The naming format of the generated variables is groupname_datasetname, where the groupname is empty for datasets in the root directory of the file. Thus, if a HDF5 file contains the datasets

/a

/b

/group1/c

/group1/d

/group2/a

/group2/b

then this routine creates the variables

a

b

group1_c

group1_d

group2_a

group2_b

in the caller’s workspace.

The black magic part of the code was taken from Pykler’s answer to this stackoverflow question

WARNING: EXISTING VARIABLES IN THE CALLER’S WORKSPACE ARE MERCILESSLY OVERWRITTEN!!!