Skip to main content

Module hdf5

Module hdf5 

Source
Expand description

A reader for HDF5 files (the format under MATLAB v7.3 .mat files and NetCDF-4 .nc files): groups, datasets, attributes and their data, without the HDF5 library.

Supported: superblock versions 0 to 3 (and a user block, as MATLAB writes); object headers of version 1 and 2 with continuation blocks; groups by symbol table (version 1 B-tree and local heap) or by link messages; datasets with compact, contiguous or chunked storage (the version 1 B-tree chunk index and the single-chunk, implicit, fixed-array, extensible-array and version 2 B-tree indexes of layout versions 4 and 5) and the deflate, shuffle, Fletcher-32 and LZF filters; fixed-point, floating-point, string, bitfield, enumeration, compound, array, reference and variable-length datatypes (also those committed to the file); fill values; attributes in the object header, and dense link and attribute storage (a fractal heap indexed by a version 2 B-tree, which groups of the newest format switch to beyond eight links or attributes). Not supported (reported as errors): external and virtual storage, the shared message heap, the other filters, and writing.

See the book entry Scientific data files.

Structs§

H5Array
An attribute or the data of a dataset: its shape (HDF5’s, row-major; empty for a scalar), its type and its elements in row-major order.
H5Dataset
A dataset: its attributes and its data.
H5Group
A group: a named collection of groups and datasets, in the order the file lists them.
Hdf5File
A parsed HDF5 file: the tree of objects under the root group, and the object a reference points to.

Enums§

H5Object
An object of the file.
H5Type
The class of an HDF5 datatype, with what is needed to decode its elements.
H5Value
The value of an element of an HDF5 datatype.

Functions§

hdf5_decode
Parses an HDF5 file held in memory. The signature is searched for at offsets 0, 512, 1024, … (a user block, as in MATLAB v7.3 files, comes first).
mat73_decode
Reads a MATLAB v7.3 MAT-file (an HDF5 file with a 512-byte user block): the variables in the order the file lists them (alphabetical), as the values crate::mat_decode gives for level 5. Numeric, logical and character arrays (empty ones too), complex arrays, sparse matrices, cell arrays and structures (scalar and arrays) are read; function handles, objects and tables are reported as errors. The order of a structure’s fields is MATLAB’s (the attribute MATLAB_fields) when the file has it, and the file’s (alphabetical) otherwise.
netcdf4_decode
Reads the root group of a NetCDF-4 file into the NetCdf of the classic model: dimensions (the file’s dimension scales), global attributes and variables with their attributes. Types NetCDF-3 lacks (64-bit and unsigned integers, enumerations) are widened to f64; subgroups and user-defined types are not represented (variables in subgroups are listed under the path group/name). An unlimited dimension has length None, and numrecs is its current length.
read_hdf5_file
Reads an HDF5 file.
read_mat73_file
Reads a MATLAB v7.3 MAT-file.
read_netcdf4_file
Reads a NetCDF-4 file.