I found a similar question at HDF5 Example code
but I'm having trouble viewing the hdf5 dataset contents correctly.
The dataset I'm looking at contains string headers with strings in the first column and doubles in the others.
Here's what my code looks like:
public static void readh5(string path, string filename)
{
H5.Open();
var fileID = H5F.open(path + filename, H5F.OpenMode.ACC_RDONLY);
var groupID = H5G.open(fileID, "/Example Group/");
var datasetID = H5D.open(groupID, "Events");
var dataSpace = H5D.getSpace(datasetID);
var size = H5S.getSimpleExtentDims(dataSpace);
var dataType = H5D.getType(datasetID);
double[,] dataArray = new double[size[0],11];
var wrapArray = new H5Array<double>(dataArray);
H5D.read(datasetID, dataType, wrapArray);
Console.WriteLine(wrapArray);
}
When I debug and look into wrapArray each element is an incredibly large or small doubles from 10^300 to 10^-300 in value and I don't know why. I don't think those are ID numbers of the elements. I've tried changing the datatype of wrapArray and dataArray to object but that still doesn't give me the exact contents of the dataset.
The output I'm getting for wrapArray looks like:
[0,0] 4.0633928641260729E+87
[0,1] 9.77854726248995E-320
[0,2] 1.52021104712121E-312
etc.
But what I want is:
[0,0] Event1
[0,1] 2
[0,2] 56
etc.
After reading in the dataset I want to loop through the first column to find specific strings, and get the corresponding elements in the other columns. But I have to figure out this out.