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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LiteHDF.win-x64" Version="5.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LiteHDF.win-x64" Version="5.2.0" />
                    
Directory.Packages.props
<PackageReference Include="LiteHDF.win-x64" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LiteHDF.win-x64 --version 5.2.0
                    
#r "nuget: LiteHDF.win-x64, 5.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LiteHDF.win-x64@5.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LiteHDF.win-x64&version=5.2.0
                    
Install as a Cake Addin
#tool nuget:?package=LiteHDF.win-x64&version=5.2.0
                    
Install as a Cake Tool

LiteHDF

logo

NuGet

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 Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last Updated
5.2.0 94 6/6/2026
5.1.0 154 1/9/2026

5.2.0 Update to HDF5 version 2.1.1; bug fixes