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

Can't open attributes on the root group #39

Open
braunsonm opened this issue Jul 27, 2018 · 4 comments
Open

Can't open attributes on the root group #39

braunsonm opened this issue Jul 27, 2018 · 4 comments

Comments

@braunsonm
Copy link

What are you trying to do?

View an attribute on the root path of the HDF5 File "/"

What did you do?

		f, err := hdf5.OpenFile(event.Name(), hdf5.F_ACC_RDONLY)
		if err != nil {
			log.Fatalln("Panic, could not open file")
		}

		d, err := f.OpenGroup("/")
		if err != nil {
			log.Fatalln("Panic, could not open dataset")
			return
		}

		attr, err := d.OpenAttribute("file_version")

OpenAttributes on a group doesn't seem to work. You can however call CreateAttribute, just not read from it.

What did you expect to happen?

The ability to open an attribute like on a dataset.

What version of Go, Gonum, Gonum/netlib and libhdf5 are you using?

go version go1.10.2 linux/amd64

Does this issue reproduce with the current master?

Unknown

@donkahlero
Copy link
Collaborator

Hi @Chaosca

Is it even necessary to open the group your particular example? Can you try to call
f.OpenAttribute("file_version") and remove the group related code instead?

Cheers!

@braunsonm
Copy link
Author

I don't believe that method exists @TacoVox
I can't OpenAttributes against a file handler.

@delaneyj
Copy link
Contributor

delaneyj commented May 3, 2019

@Chaosca did you ever find a solution or workaround?

@braunsonm
Copy link
Author

Nope, you could directly call the C API though. I believe that is what I ended up doing.
Or just defer work to the excellent Python API for HDF5.

For C, you'd open the attribute, similar to how it's done here: https://github.com/gonum/hdf5/blob/master/h5a_attribute.go#L35

And using this function: https://support.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Open

And then you'd read the data from the attribute.

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

3 participants