Documentation
¶
Overview ¶
Package hdf5 reads the parts of the HDF5 file format that the open science centre's strain files use, as the HDF5 File Format Specification, version 3.0, describes them, and refuses the rest.
It reads a version 0 superblock with eight-byte offsets and lengths, version 1 object headers and their continuations, and old-style groups: a version 1 B-tree of symbol table nodes over a local heap of names.
It reads datasets and attributes of little-endian integers, binary32 and binary64 floats, and fixed and variable-length strings.
A dataset is contiguous or chunked, and a chunk may be deflated and may carry a Fletcher-32 checksum, which is checked.
Anything else is refused with ErrUnsupported, which names the part and its section of the specification. Bytes that contradict the specification or themselves are refused with ErrCorrupt, and bytes that are not HDF5 at all with ErrNotHDF5. A refusal gives nothing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrCorrupt ¶
func ErrCorrupt() error
ErrCorrupt is the cause of a refusal when the file contradicts the specification or itself: a field out of range, an address outside the file, a checksum that does not match, a stream that does not inflate.
func ErrNotFound ¶
func ErrNotFound() error
ErrNotFound is the cause of an error when a path or an attribute name is not in the file.
func ErrNotHDF5 ¶
func ErrNotHDF5() error
ErrNotHDF5 is the cause of a refusal when the bytes are not an HDF5 file: the format signature is missing.
func ErrUnsupported ¶
func ErrUnsupported() error
ErrUnsupported is the cause of a refusal when the file is HDF5 but uses a part of the format this reader does not read. The refusal names the part.
func ErrWrongType ¶
func ErrWrongType() error
ErrWrongType is the cause of an error when a read asks for a kind of value the object does not hold, such as text from a float dataset.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is an open HDF5 file. It reads from the io.ReaderAt it was given, when asked, and holds nothing of the file but its superblock.
func NewFile ¶
NewFile opens the HDF5 file a reader holds, so many bytes long. It refuses a file that is not HDF5 with ErrNotHDF5, one that uses a part of the format this reader does not read with ErrUnsupported, saying which part and where, and a size below nothing, and then gives no file.
func (*File) Attribute ¶
Attribute is the elements of an attribute of the group or dataset at a path, by its name, such as Xspacing on strain/Strain. It refuses a path or a name the file does not have, and then gives none.
func (*File) Members ¶
Members is the names of the members of the group at a path, in order. The path "" and "/" are the root group. It refuses a path the file does not have and an object there that is no group, and then gives none.
type Values ¶
type Values struct {
// contains filtered or unexported fields
}
Values is the elements of a dataset or an attribute as read: their shape, and the bytes the file holds, decoded when asked for in a kind.
func (*Values) Floats ¶
Floats is the values as floats, in the file's order. It refuses values that are not floating-point, and then gives none.
func (*Values) Integers ¶
Integers is the values as integers, in the file's order. It refuses values that are not fixed-point, and then gives none.