Replies: 1 comment 2 replies
-
Not sure if you've already seen this question but I did a quick scan of the PureHDF library and that one is able to read multidimensional arrays. I'm not sure if it's also able to read 2d arrays of structs but I could trick it into believing I want 2d arrays of floats. And then it returns that array nicely. I can then parse that back into SurfaceCurrents since the layout is fixed. But I'm still curious if HDF5-CSharp is able to do 2d arrays of structs! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Lior, I got a bit stuck and was wondering if you could give me a pointer in the right direction. I am faced with an HDF5 file that has, at its core, a 2 dimensional array of structs. Each struct consists of two floats that represent the surface-current-speed and the surface-current-direction. Now what I did was try the Hdf5.ReadCompounds function and give it the following struct as T:
I've added the HDF5 file for your convenience so you get an idea what I'm trying to read. The relevant dataset is present in each /SurfaceCurrent/SurfaceCurrent.01/Group_0xx group and is called 'values'. When you open it you see an array of 596x433 of structs that has a surfaceCurrentSpeed and a surfaceCurrentDirection.
The closest I got was using the ReadCompounds function as you can see in file:
https://github.com/flappah/S1XViewer/blob/master/S1XViewer.Model/S111DCF2DataParser.cs
It calls on:
https://github.com/flappah/S1XViewer/blob/master/S1XViewer.HDF/DatasetReader.cs
which tries to read the compounds dataset. It does read it but it returns an array of 596 SurfaceCurrentInstances and not a 2 dimensional array. I tried a couple of ways to tackle this but somehow I'm not getting it right. Could you give me a pointer in the right direction? Thanks in advance!
111US00_CBOFS_20221013T00Z.h5.zip
Beta Was this translation helpful? Give feedback.
All reactions