python - Appending more datasets into an existing Hdf5 file without deleting other groups and datasets -
i have hdf5 file contains groups , subgroups inside there datasets. want open file , add datasets groups. took following approach quite simple in python.
import h5py f = h5py.file('filename.h5','w') f.create_dataset('/group1/subgroup1/dataset4', data=pngfile) f.close()
the before file looked before file image
after file looks after file image
but want not delete other datasets , groups rather append dataset4 in line.
just python open() function, 'w' truncate existing file. use 'a' mode add content file:
import h5py f = h5py.file('filename.h5','a') f.create_dataset('/group1/subgroup1/dataset4', data=pngfile) f.close()
Comments
Post a Comment