Documentation ¶
Overview ¶
Package h5 wraps the HDF5 library. HDF5 is a data model, library, and file format for storing and managing data.
Index ¶
- type File
- func (o *File) AppendToArray(path string, v []float64)
- func (o *File) Close()
- func (o File) Filename() string
- func (o File) Filepath() string
- func (o *File) GetArray(path string) (v []float64)
- func (o *File) GetDeep2(path string) (a [][]float64)
- func (o *File) GetDeep2raw(path string) (m, n int, a []float64)
- func (o *File) GetDeep3(path string) (a [][][]float64)
- func (o *File) GetFloat64(path string) float64
- func (o *File) GetInt(path string) int
- func (o *File) GetIntAttribute(path, key string) (val int)
- func (o *File) GetInts(path string) (v []int)
- func (o *File) GetIntsAttribute(path, key string) (vals []int)
- func (o *File) GetStringAttribute(path, key string) (val string)
- func (o *File) PutArray(path string, v []float64)
- func (o *File) PutDeep2(path string, a [][]float64)
- func (o *File) PutDeep3(path string, a [][][]float64)
- func (o *File) PutFloat64(path string, val float64)
- func (o *File) PutInt(path string, val int)
- func (o *File) PutInts(path string, v []int)
- func (o *File) PutVarArray(path string, v []float64)
- func (o *File) ReadArray(v []float64, path string) (dims []int)
- func (o *File) SetIntAttribute(path, key string, val int)
- func (o *File) SetIntsAttribute(path, key string, vals []int)
- func (o *File) SetStringAttribute(path, key, val string)
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 represents a HDF5 file
func Create ¶
Create creates a new file, deleting existent one
Input: dirOut -- directory name that will be created if non-existent Note: dirOut may contain environment variables fnameKey -- filename key; e.g. without extension useGob -- use Go's own format gob instead of HDF5 Output: returns a new File object where the filename will be: fnameKey + .h5 if useGob == false, or fnameKey + .gob if useGob == true
func Open ¶
Open opens an existent file for read only
Input: dirIn -- directory name where the file is located Note: dirIn may contain environment variables fnameKey -- filename key; e.g. without extension useGob -- use Go's own format gob instead of HDF5 Output: returns a new File object where the filename will be: fnameKey + .h5 if useGob == false, or fnameKey + .gob if useGob == true
func (*File) AppendToArray ¶
AppendToArray appends values to a variable array
func (*File) GetDeep2raw ¶
GetDeep2raw returns the serialized data corresponding to a Deep2 slice
func (*File) GetDeep3 ¶
GetDeep3 gets a deep slice with 3 levels from file. Memory will be allocated
func (*File) GetFloat64 ¶
GetFloat64 gets one float64 from file
Note: this is a convenience function wrapping GetArray
func (*File) GetInt ¶
GetInt gets one integer from file
Note: this is a convenience function wrapping GetInts
func (*File) GetIntAttribute ¶
GetIntAttribute gets int attribute
func (*File) GetIntsAttribute ¶
GetIntsAttribute gets slice-of-ints attribute
func (*File) GetStringAttribute ¶
GetStringAttribute gets string attribute
func (*File) PutArray ¶
PutArray puts an array with name described in path into HDF5 file
Input: path -- HDF5 path such as "/myvec" or "/group/myvec" v -- slice of float64
func (*File) PutDeep2 ¶
PutDeep2 puts a Deep2 slice into file
Input: path -- HDF5 path such as "/myvec" or "/group/myvec" a -- slice of slices of float64 Note: Slice will be serialized
func (*File) PutDeep3 ¶
PutDeep3 puts a deep slice with 3 levels and name described in path into HDF5 file
Input: path -- HDF5 path such as "/myvec" or "/group/myvec" a -- slice of slices of slices of float64 Note: Slice will be serialized
func (*File) PutFloat64 ¶
PutFloat64 puts one float64 into file
Input: path -- HDF5 path such as "/myvec" or "/group/myvec" val -- value Note: this is a convenience function wrapping PutArray
func (*File) PutInt ¶
PutInt puts one integer into file
Input: path -- HDF5 path such as "/myvec" or "/group/myvec" val -- value Note: this is a convenience function wrapping PutInts
func (*File) PutInts ¶
PutInts puts a slice of integers into file
Input: path -- HDF5 path such as "/myvec" or "/group/myvec" v -- slice of integers
func (*File) PutVarArray ¶
PutVarArray puts a variable array with name described in path into HDF5 file
Input: path -- HDF5 path such as "/myvec" or "/group/myvec" v -- slice of float64
func (*File) ReadArray ¶
ReadArray reads an array from file into existent pre-allocated memory
Input: path -- HDF5 path such as "/myvec" or "/group/myvec" Output: array -- values in pre-allocated array => must know dimension dims -- dimensions (for confirmation)
func (*File) SetIntAttribute ¶
SetIntAttribute sets int attibute
func (*File) SetIntsAttribute ¶
SetIntsAttribute sets slice-of-ints attibute
func (*File) SetStringAttribute ¶
SetStringAttribute sets a string attibute