-
Notifications
You must be signed in to change notification settings - Fork 33
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
Use of HDF5 1.12 #85
Comments
I surmise this: p := make([]ohlcv, 1) needs to read instead: var p ohlcv and thus: fmt.Printf("data[%d]: O:%.2f H:%.2f L:%.2f C:%.2f V:%.2f \n", i, p.PriceOpen, p.PriceHigh, p.PriceLow, p.PriceClose, p.Volume) |
Thanks for a quick response. Took that code from the example but also tried what you are suggesting. Unfortunately that leads to this error: which makes sense, as the function definition is: func (*hdf5.Table).Next(data interface{}) error
(hdf5.Table).Next on pkg.go.dev
Next reads packets from a packet table starting at the current index into the value pointed at by data. i.e. data is a pointer to an array or a slice. Can it be that you are using some newer version? EDIT: Just checked the implementations of the Next function in h5pt_table.go and they are identical. |
Did some more research! If I replace the printing line with fmt.Printf("data[%d]: %v\n", i, p) Then there are two possible results dependant on the defintion of the struct:
where the first column (Index) is perfectly correct but the rest is just messed up. This leads me to think that the reading ignores the This hypothesis is somewhat being broken by the fact that even if I leave the struct defintion full (including the strings) then the Next passes and if I do not attempt to print the string values (Exchange / Pair), then the values are displayed but wrong. Which is the original output. I am being totally lost. But have a simple question: How does handling string in structs for reading from HDF5 work? I have noticed that in the master/cmd/test-go-table-01-readback/main.go file there is definition of struct: type particle struct {
// name string `hdf5:"Name"` // FIXME(sbinet)
Lati int32 `hdf5:"Latitude"`
Longi int64 `hdf5:"Longitude"`
Pressure float32 `hdf5:"Pressure"`
Temperature float64 `hdf5:"Temperature"`
// isthep []int // FIXME(sbinet)
// jmohep [2][2]int64 // FIXME(sbinet)
} That somehow indicates that strings can be an issue. |
What are you trying to do?
I am trying to read HDF5 database (version 1.12.1).
The datatabase was populated using Python's h5py library. The data is pandas dataframe but guess that should be no problem as h5ls and HDFView app read the data without any issues.
What did you do?
I used the example from this repo for reading table. Also tried to use DataSet instead. This is the code excerpt:
What did you expect to happen?
I expected something like this:
What actually happened?
What I get is:
Also when trying to access Exchange or Pair attributes, I get the following error:
What version of Go, Gonum, Gonum/netlib and libhdf5 are you using?
Does this issue reproduce with the current master?
Yes, it does!
The text was updated successfully, but these errors were encountered: