HDF5dotnet can not read h5oina files

I need to read an H5 file with HDF5dotnet.dll, the dll works perfectly for many h5 files. The problem comes with a file *.h5oina which I can open with HDFviewer but not with the dll --> access violation…memory…
When I save it to a new h5 file from HDFviewer I can open this new file with the HDF5dotnet.dll.
So I guess my h5oina file is sligthly different but why HDFviewer can read it and not HDF5dotnet.dll ?
If someone know what can I try ? I don’t know what to do now.
Thank you all
here is doc on h5oina files, https://github.com/oinanoanalysis/h5oina/blob/master/H5OINAFile.md

Hi @benoitbeausir1,

Would you mind to share the .h5oina file that is causing issues?

Thanks!

Hi
here is the file
https://filesender.renater.fr/?s=download&token=6bd85380-81a1-4206-868c-46e07278bcfa
Thanks

Hi @benoitbeausir1,

Thanks for sharing the .h5oina file.

FYI, we can successfully open the file in C#, although through the usage of HDFql (and not HDF5dotnet).

That said, is there a particular dataset or attribute (from the file) you wish to read in C#? With this info, we could post an example on how to read such dataset or attribute in C# using HDFql.

Hope it helps!

Hi
I need to read in VB.net
actually my code crash when I open the file
Dim fileId = H5F.open(filefull, H5F.OpenMode.ACC_RDONLY)
HDFql is another library ?

my code is OK, when I saved the H5oina file into another h5 file by HDFView, no problem I can open the file read in it…

1 Like

Some of the data sets use LZF compression which will mess up readers if they are not built with the proper compression plugins.

1 Like

Hello
I succeeded to read it with HDF.Pinvoke library
but it needs 15 lines of code to extract a simple string in H5 files !!
Ty

Hi @benoitbeausir1,

You can have your code simpler and less verbose through the usage of HDFql, which supports P/Invoke. Example in C#:

// read dataset 'my_string'
HDFql.Execute("SELECT FROM my_string");

// set HDFql cursor to first element
HDFql.CursorFirst();

// get cursor element as a string and assign it to variable 'str'
string str = HDFql.CursorGetChar();

// print value of variable 'str'
System.Console.WriteLine("The string value is " + str);

Hope it helps!

hello thank you
I have tried to use HDFql, unfortunatly I could not import it in my VS project.
when I tried to import in my references it says the dll could not be added, verify it is a valid component… (sorry I translate from french)
also sorry I am not informaticien, I am not aware or familiar with all that
So finaly I had to create my own “CursorGetChar” function.
the thing was I thought h5 format was much more easy to read

Hi @benoitbeausir1,

Would you mind to send a screenshot of the error you are facing?

Thanks!

Hi @benoitbeausir1,

Thanks for the screenshot.

It seems that you are trying to use HDFql library as an assembly or COM component. Instead, HDFql should be used as a normal shared library by your program - please see this post on this forum as well as this post on Stack Overflow for additional information.

Hope it helps!

@benoitbeausir1, hdf5dotnet has been deprecated long ago in favor of HDF.PInvoke and community libraries. I created the HDF.PInvoke.1.10 library (https://www.nuget.org/packages/HDF.PInvoke.1.10) to ease the usage of HDF.PInvoke in .NET. But using the C API directly is always a bit cumbersome as you have already experienced. You could try using HDF5-CSharp (https://www.nuget.org/packages/HDF5-CSharp) or the read-only PureHDF package (https://www.nuget.org/packages/PureHDF) which both offer a high level API to work with HDF5 files.

thank you apollo3zehn-h5
I will try that next time I need to read H5 files, I passed about 4 days to create my functions to extract arrays, string, single… and up to now it seems sufficient for what I need
And also thank you for the HDF.PInvoke

1 Like

Hello mike
you are right, I cannot read the unprocessed patterns. it returns zeros.
Do you know if there is a parameter in the H5 read function, or something to say that the data are LZH compressed ? the compression is automatically detected, I don’t find any help.
Benoit

Not sure. I have been working/helping a few other individuals who are trying to read those files and they ran into the same problem. They were trying to compile HDF5 with all of the necessary plugins so that they could read the data from the .h5oina file.

I was going to add support into DREAM.3D and EBSDLib to read H5OINA files but this compression part has stopped me attempting to add the readers.

h5dump -Hp should give you information about the compression and its parameters even when compression library is not available. Also, you may try to use h5debug or l5ls (see section 3.4.2 in this document) to troubleshoot.

Elena

1 Like

There are APIs to get information about a filter. One can use H5Pget_nfilters to get number of filters and then iterate over the number of filters using H5Pget_filter.

yes I also stopped. Impossible to know how to read that. pfffff
A simple binary file containing the patterns would be much much easier to read.