LiteHDF.win-x64
5.2.0
dotnet add package LiteHDF.win-x64 --version 5.2.0
NuGet\Install-Package LiteHDF.win-x64 -Version 5.2.0
<PackageReference Include="LiteHDF.win-x64" Version="5.2.0" />
<PackageVersion Include="LiteHDF.win-x64" Version="5.2.0" />
<PackageReference Include="LiteHDF.win-x64" />
paket add LiteHDF.win-x64 --version 5.2.0
#r "nuget: LiteHDF.win-x64, 5.2.0"
#:package LiteHDF.win-x64@5.2.0
#addin nuget:?package=LiteHDF.win-x64&version=5.2.0
#tool nuget:?package=LiteHDF.win-x64&version=5.2.0
LiteHDF

A tiny high-level library that facilitates the reading of HDF5 files.
Uses v2.1.1 native library under the hood.
Note: Only compatible with Windows x64.
Usage
try
{
using var hdf = Hdf.Open(filePath);
var energyValues = hdf.GetData<double>("/entries/data/energies");
}
catch (IOException)
{
// File could not be opened (not found, access denied, or not a valid HDF document)
}
Listing the group structure
Getting the structure of a group (or the root) is done by calling the GetGroupObjectData method. It returns an array of HdfObject structs containing the name, type and a reference to the file of each object in the group.
HdfObject[] objects = hdf.GetGroupObjectData("/entries");
foreach (var obj in objects)
{
Console.WriteLine($"{obj.Name} ({obj.Type})");
}
The HdfObject struct has the following properties:
struct HdfObject
{
string Name; // Name of the object
ObjectType Type; // Group or Dataset
HdfFile File; // Reference to the containing file
}
Reading data
Getting values from a dataset is done by the GetData<TValue> or GetString methods. The former returns an array of the specified data type (if it matches the data type of the dataset) and the latter is only used for datasets that contain variable-length string data.
The GetData method returns a HdfData<TValue> object:
class HdfData<TValue>
{
string DatasetPath;
ulong? ChangeTime;
TValue[] Value;
}
The ChangeTime property contains the modification time of the dataset as the number of seconds since the UNIX epoch. Use DateTimeOffset.FromUnixTimeSeconds((long)changeTime) to convert it into a native date time object.
If the dataset doesn't exist, or if TValue doesn't match the element size of the dataset's data type, null is returned.
For single values, simply use the LINQ method SingleOrDefault on the Value property.
Library version
To get the version of the underlying HDF5 library, use the GetLibraryVersion method:
Version version = Hdf.GetLibraryVersion();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
5.2.0 Update to HDF5 version 2.1.1; bug fixes