Renaming HDF5 groups/datasets
Is there a recommended way for renaming groups and datasets in an HDF5 file? I'm thinking of using HDF5CreateLink to make a new link to the object, followed by HDF5UnlinkObject to kill the old link.
My understanding is that HDF5UnlinkObject doesn't delete the object itself, but only the link reference to the object. So if multiple links to an object exist, unlinking one won't affect my use of the other links to the object. If I unlink the only existing link to an object, I no longer will be able to access that object despite its existence. Is this the correct way to think about this?
On a similar note, if I want to actually delete a dataset or group (and reclaim the space it occupied), it sounds like I need to use h5repack, or else more manually copy all existing links and objects to a completely new HDF5 file?
That sounds right.
Yes, if you want to reclaim the space in the file you need to use h5repack or your own equivalent. The HDF5 library does not reuse space used by unlinked objects as explained here.
September 16, 2022 at 03:24 pm - Permalink