删除或更新 HDF5 中的数据集? [英] Delete or update a dataset in HDF5?

查看:42
本文介绍了删除或更新 HDF5 中的数据集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式更改与 HDF5 文件中的数据集关联的数据.我似乎找不到按名称删除数据集(允许我使用修改后的数据再次添加它)或按名称更新数据集的方法.我将 C API 用于 HDF5 1.6.x,但指向任何 HDF5 API 的指针都会很有用.

I would like to programatically change the data associated with a dataset in an HDF5 file. I can't seem to find a way to either delete a dataset by name (allowing me to add it again with the modified data) or update a dataset by name. I'm using the C API for HDF5 1.6.x but pointers towards any HDF5 API would be useful.

推荐答案

根据用户指南:

HDF5 目前没有提供一种简单的机制来从文件中删除数据集或回收被删除对象占用的存储空间.

HDF5 does not at this time provide an easy mechanism to remove a dataset from a file or to reclaim the storage space occupied by a deleted object.

如此简单的删除似乎是不可能的.但该部分继续:

So simple deletion appears to be out of the question. But the section continues:

可以使用 H5Ldelete 函数和 h5repack 实用程序.使用 H5Ldelete 函数,可以从文件结构中删除数据集的链接.删除所有链接后,任何应用程序都无法访问该数据集,并有效地从文件中删除了该数据集.恢复未链接数据集占用空间的方法是将文件的所有对象写入一个新文件.应用程序无法访问任何未链接的对象,并且不会包含在新文件中.可以使用自定义程序或 h5repack 实用程序将对象写入新文件.

Removing a dataset and reclaiming the space it used can be done with the H5Ldelete function and the h5repack utility program. With the H5Ldelete function, links to a dataset can be removed from the file structure. After all the links have been removed, the dataset becomes inaccessible to any application and is effectively removed from the file. The way to recover the space occupied by an unlinked dataset is to write all of the objects of the file into a new file. Any unlinked object is inaccessible to the application and will not be included in the new file. Writing objects to a new file can be done with a custom program or with the h5repack utility program.

这篇关于删除或更新 HDF5 中的数据集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆