Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting dtype in terms of int32 or int64 #52

Open
jeffhu1 opened this issue Jul 1, 2019 · 2 comments
Open

Getting dtype in terms of int32 or int64 #52

jeffhu1 opened this issue Jul 1, 2019 · 2 comments

Comments

@jeffhu1
Copy link

jeffhu1 commented Jul 1, 2019

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

@kortschak
Copy link
Member

Please provide a reproducer and more detailed expectations.

@jeffhu1
Copy link
Author

jeffhu1 commented Jul 2, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants