Not able to read string attribute from dataset
Created by: mghh
What are you trying to do?
I try to read a string attribute from a dataset.
What did you do?
Here is a code snippet:
var version int64
versionAttr, _ := dset.OpenAttribute("version")
versionAttr.Read(&version, hdf5.T_STD_U64LE)
fmt.Println(version)
var start string
startAttr, _ := dset.OpenAttribute("start")
startAttr.Read(&start, hdf5.T_GO_STRING)
fmt.Println(start)
Reading the version attribute is fine. Reading the 'start' attribute results in empty string. Here the snippet from h5dump:
ATTRIBUTE "start" {
DATATYPE H5T_STRING {
STRSIZE H5T_VARIABLE;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_UTF8;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
(0): "2018-09-04T02:27:43"
}
}
ATTRIBUTE "version" {
DATATYPE H5T_STD_I64LE
DATASPACE SCALAR
DATA {
(0): 1
}
}
What did you expect to happen?
I am excepting a variable start with this content "2018-09-04T02:27:43".
What actually happened?
What version of Go, Gonum, Gonum/netlib and libhdf5 are you using?
go: hdf5: master (c2570736)
Problem occurs either with libhdf5: 1.8.20 and libhdf5: 1.10.2
Does this issue reproduce with the current master?
yes.