Created
September 1, 2009 10:57
-
-
Save tkf/179045 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import h5py | |
ispace = ' ' * 2 | |
def see_dataset(dset, indent=0): | |
sp = ispace * (indent+1) | |
vstr = str(dset.value) | |
print "\n".join([sp + vi for vi in vstr.split('\n')]) | |
def see_group(group, indent=0): | |
sp = ispace * indent | |
for (name, value) in group.iteritems(): | |
if isinstance(value,h5py.Dataset): | |
print sp + name + ":" | |
see_dataset(value, indent+1) | |
elif isinstance(value,h5py.Group): | |
print sp + name + ":" | |
see_group(value, indent+1) | |
def see_hdf5(path): | |
f = h5py.File(path) | |
see_group(f) | |
return f | |
see_hdf5('myfile.hdf5').close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment