H5T_STRING 的 hdf5dump
我试图弄清楚如何从 HDF5 文件(测深属性网格/BAG)转储文本块。当我执行 h5dump -d /BAG_root/metadata H11703_Office_5m.bag
以及我尝试过的任何其他操作时,我总是会获取引用 XML 的每个字符的数据。是否有一个“简单”选项可以将原始数据内容转储到文件或终端?
DATASET "/BAG_root/metadata" {
DATATYPE H5T_STRING {
STRSIZE 1;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SIMPLE { ( 5097 ) / ( H5S_UNLIMITED ) }
DATA {
(0): "<", "?", "x", "m", "l", " ", "v", "e", "r", "s", "i", "o", "n", "=",
(14): """, "1", ".", "0", """, "?", ">", "
", "<", "s", "m",
(25): "X", "M", "L", ":", "M", "D", "_", "M", "e", "t", "a", "d", "a",
I'm trying to figure out how to dump a text block from an HDF5 file (a Bathymetric Attributed Grid / BAG). When I do h5dump -d /BAG_root/metadata H11703_Office_5m.bag
, and anything else I've tried, I always get the data with each character of the XML quoted. Is there an "easy" option to have it dump the raw data contents to a file or the terminal?
DATASET "/BAG_root/metadata" {
DATATYPE H5T_STRING {
STRSIZE 1;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SIMPLE { ( 5097 ) / ( H5S_UNLIMITED ) }
DATA {
(0): "<", "?", "x", "m", "l", " ", "v", "e", "r", "s", "i", "o", "n", "=",
(14): """, "1", ".", "0", """, "?", ">", "
", "<", "s", "m",
(25): "X", "M", "L", ":", "M", "D", "_", "M", "e", "t", "a", "d", "a",
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当我在 OpenNavSurf 邮件列表上提出这个主题后,Marcus Cole 通过电子邮件向我发送了这个解决方案:
这会写出一个干净的 XML 文件。
Marcus Cole emailed me this solution after I brought up the topic on the OpenNavSurf mailing list:
This writes out a clean XML file.
回复:Python 和BAG,GDAL 1.7.0+支持BAG格式;例如:
Re: Python & BAG, GDAL 1.7.0+ supports the BAG format; e.g.:
数据存储为 5097 个单字符串数组 (
STRSIZE 1
)。要转储文本,它应该存储为真实字符串(例如,在标量数据空间中)。因此,我认为您不能单独使用
h5dump
来完成此操作,您可能必须使用sed
或您最喜欢的正则表达式工具来处理转储。The data is stored as an array of 5097 single characters strings (
STRSIZE 1
). To dump the text, it should have been stored as a real string (e.g. in a scalar dataspace).So I think you cannot do it with
h5dump
alone, you probably have to process the dump withsed
or your favorite regexp tool.