hdf5

package
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package hdf5 reads the open science centre's strain files. The format itself is read by github.com/scigolib/hdf5; this package is the few calls celestial's users build with, held up by theirs.

A File gives a group's members, a dataset's values and a dataset's attributes, each by a slash-separated path such as strain/Strain. Values are floats, integers or texts, read whole.

What their package refuses, this one refuses, with their error inside its own. A failed read gives no result.

Three things here are this package's doing and not the format's. NewFile copies the reader's bytes to a temporary file, since theirs opens a file by name alone, and Close removes the copy.

Their package gives a dataset's integers as float64, so an integer of 2^53 or more is refused: it cannot be told from its neighbours. And the attributes of a group are not read, only a dataset's.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// contains filtered or unexported fields
}

File is an HDF5 file, opened by scigolib's reader from a copy of the caller's bytes.

func NewFile

func NewFile(reader io.ReaderAt, size int64) (*File, error)

NewFile opens the size bytes of a reader as an HDF5 file. Bytes that are no HDF5 file, or one their package does not read, give its error and no File. Close the File when done with it.

func (*File) Attribute

func (file *File) Attribute(path, name string) (*Values, error)

Attribute is the values of an attribute of the dataset at a path, such as Xspacing of strain/Strain. A path or a name that is not there gives an error and no values. The attributes of a group are not read.

func (*File) Close added in v0.0.9

func (file *File) Close() error

Close closes the file and removes its copy. The caller's reader is left as it was.

func (*File) Members

func (file *File) Members(path string) ([]string, error)

Members is the names a group holds, sorted. An empty path and / are the root. A path that is not there, or is no group, gives an error and no names.

func (*File) Read

func (file *File) Read(path string) (*Values, error)

Read is the values of the dataset at a path such as strain/Strain. A path that is not there, one that is no dataset, and a dataset their package does not read each give an error and no values.

type Values

type Values struct {
	// contains filtered or unexported fields
}

Values is what a dataset or an attribute holds: its shape, and its elements as the one kind they are.

func (*Values) Floats

func (held *Values) Floats() ([]float64, error)

Floats is the values as floats, in file order. Values of another kind give an error and no floats.

func (*Values) Integers

func (held *Values) Integers() ([]int64, error)

Integers is the values as integers, in file order. Values of another kind give an error and no integers.

func (*Values) Shape

func (held *Values) Shape() []uint64

Shape is the sizes of the values' dimensions. A scalar has none.

func (*Values) Texts

func (held *Values) Texts() ([]string, error)

Texts is the values as texts, in file order. Values of another kind give an error and no texts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL