hdf5
hdf5 copied to clipboard
Getting dtype in terms of int32 or int64
What are you trying to do?
I am trying to get the exact size of a datatype
What did you do?
Tried using Datatype.GoType(), but this aliases everything to golang int
What did you expect to happen?
Expected to get an exact datatype
What actually happened?
Didn't get an exact datatype
Please provide a reproducer and more detailed expectations.
package main
import (
"fmt"
"gonum.org/v1/hdf5"
)
func main() {
f, _ := hdf5.OpenFile("myFile.h5", hdf5.F_ACC_RDONLY)
myDataset, _ := f.OpenDataset("mydataset")
dtype, _ := myDataset.Datatype()
// this aliases to the general "int" format, which doesn't get to the specificity of int32 vs 64
fmt.Println(dtype.Class())
// this just returns int, which is int64 on my machine
fmt.Println(dtype.GoType())
}
Reading the file with h5py, I know that the type is stored as int32, however gonum/hdf5 just returns it as a general int type. I'd like to know what exact type it is. It seems like these lines could be related. Any advice would be appreciated.