hdf5

package module
v0.0.0-...-f747bbf Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2017 License: BSD-3-Clause Imports: 6 Imported by: 5

README

go-hdf5

Build Status GoDoc

Naive cgo bindings for the C-API of hdf5.

Status

FROZEN: this package is frozen. New developments should be requested to gonum/hdf5.

This package will stay as is to not break people relying on it. But NO new developments will happen. Requests for new features, bug fixes, etc... should be directed against gonum/hdf5 (but, do note that gonum/hdf5 API is still in flux).

NOTE that starting with Go >= 1.6, one needs to run with GODEBUG=cgocheck=0 to disable the new stricter CGo rules.

Documentation

http://godoc.org/github.com/sbinet/go-hdf5

Example

Note

  • Only version 1.8.x of HDF5 is supported.
  • In order to use HDF5 functions in more than one goroutine simultaneously, you must build the HDF5 library with threading support. Many binary distributions (RHEL/centos/Fedora packages, etc.) do not have this enabled. Therefore, you must build HDF5 yourself on these systems.

Known problems

  • the h5pt packet table interface is broken.
  • support for structs with slices and strings as fields is broken

Documentation

Index

Constants

View Source
const (
	F_ACC_RDONLY  int = 0x0000 // absence of rdwr => rd-only
	F_ACC_RDWR    int = 0x0001 // open for read and write
	F_ACC_TRUNC   int = 0x0002 // Truncate file, if it already exists, erasing all data previously stored in the file.
	F_ACC_EXCL    int = 0x0004 // Fail if file already exists.
	F_ACC_DEBUG   int = 0x0008 // print debug info
	F_ACC_CREAT   int = 0x0010 // create non-existing files
	F_ACC_DEFAULT int = 0xffff // value passed to set_elink_acc_flags to cause flags to be taken from the parent file
)

File constants

Variables

This section is empty.

Functions

func Close

func Close() error

Close flushes all data to disk, closes all open identifiers, and cleans up memory. It should generally be called before your application exits.

func DisplayErrors

func DisplayErrors(on bool) error

DisplayErrors enables/disables HDF5's automatic error printing

func GarbageCollect

func GarbageCollect() error

GarbageCollect collects garbage on all free-lists of all types.

func IsHDF5

func IsHDF5(name string) bool

IsHDF5 Determines whether a file is in the HDF5 format.

Types

type ArrayType

type ArrayType struct {
	Datatype
}

func NewArrayType

func NewArrayType(base_type *Datatype, dims []int) (*ArrayType, error)

NewArrayType creates a new ArrayType. base_type specifies the element type of the array. dims specify the dimensions of the array.

func (*ArrayType) ArrayDims

func (t *ArrayType) ArrayDims() []int

ArrayDims returns the array dimensions.

func (*ArrayType) NDims

func (t *ArrayType) NDims() int

NDims returns the rank of an ArrayType.

type Attribute

type Attribute struct {
	Location
}

func (*Attribute) Close

func (s *Attribute) Close() error

Close releases and terminates access to an attribute.

func (*Attribute) GetType

func (s *Attribute) GetType() Location

Access the type of an attribute

func (*Attribute) Id

func (s *Attribute) Id() int

func (*Attribute) Read

func (s *Attribute) Read(data interface{}, dtype *Datatype) error

Read reads raw data from a attribute into a buffer.

func (*Attribute) Space

func (s *Attribute) Space() *Dataspace

Space returns an identifier for a copy of the dataspace for a attribute.

func (*Attribute) Write

func (s *Attribute) Write(data interface{}, dtype *Datatype) error

Write writes raw data from a buffer to an attribute.

type CommonFG

type CommonFG struct {
	Location
}

CommonFG is for methods common to both File and Group

func (*CommonFG) CreateDataset

func (g *CommonFG) CreateDataset(name string, dtype *Datatype, dspace *Dataspace) (*Dataset, error)

CreateDataset creates a new Dataset.

func (*CommonFG) CreateDatasetWith

func (g *CommonFG) CreateDatasetWith(name string, dtype *Datatype, dspace *Dataspace, dcpl *PropList) (*Dataset, error)

CreateDatasetWith creates a new Dataset with a user-defined PropList.

func (*CommonFG) CreateGroup

func (g *CommonFG) CreateGroup(name string) (*Group, error)

CreateGroup creates a new empty group and links it to a location in the file.

func (*CommonFG) NumObjects

func (g *CommonFG) NumObjects() (uint, error)

NumObjects returns the number of objects in the Group.

func (*CommonFG) ObjectNameByIndex

func (g *CommonFG) ObjectNameByIndex(idx uint) (string, error)

ObjectNameByIndex returns the name of the object at idx.

func (*CommonFG) OpenDataset

func (g *CommonFG) OpenDataset(name string) (*Dataset, error)

OpenDataset opens a named Dataset.

func (*CommonFG) OpenGroup

func (g *CommonFG) OpenGroup(name string) (*Group, error)

OpenGroup opens an existing child group from this Group.

type CompoundType

type CompoundType struct {
	Datatype
}

func NewCompoundType

func NewCompoundType(size int) (*CompoundType, error)

NewCompoundType creates a new CompoundType. size is the size in bytes of the compound datatype.

func (*CompoundType) Insert

func (t *CompoundType) Insert(name string, offset int, field *Datatype) error

Insert adds a new member to a compound datatype.

func (*CompoundType) MemberClass

func (t *CompoundType) MemberClass(mbr_idx int) TypeClass

MemberClass returns datatype class of compound datatype member.

func (*CompoundType) MemberIndex

func (t *CompoundType) MemberIndex(name string) int

MemberIndex returns the index of a compound or enumeration datatype member.

func (*CompoundType) MemberName

func (t *CompoundType) MemberName(mbr_idx int) string

MemberName returns the name of a compound or enumeration datatype member.

func (*CompoundType) MemberOffset

func (t *CompoundType) MemberOffset(mbr_idx int) int

MemberOffset returns the offset of a field of a compound datatype.

func (*CompoundType) MemberType

func (t *CompoundType) MemberType(mbr_idx int) (*Datatype, error)

MemberType returns the datatype of the specified member.

func (*CompoundType) NMembers

func (t *CompoundType) NMembers() int

NMembers returns the number of elements in a compound or enumeration datatype.

func (*CompoundType) Pack

func (t *CompoundType) Pack() error

Pack recursively removes padding from within a compound datatype. This is analogous to C struct packing and will give a space-efficient type on the disk. However, using this may require type conversions on more machines, so may be a worse option.

type Dataset

type Dataset struct {
	Location
}

func (*Dataset) Close

func (s *Dataset) Close() error

Close releases and terminates access to a dataset.

func (*Dataset) CreateAttribute

func (s *Dataset) CreateAttribute(name string, dtype *Datatype, dspace *Dataspace) (*Attribute, error)

Creates a new attribute at this location.

func (*Dataset) CreateAttributeWith

func (s *Dataset) CreateAttributeWith(name string, dtype *Datatype, dspace *Dataspace, acpl *PropList) (*Attribute, error)

Creates a new attribute at this location.

func (*Dataset) Datatype

func (s *Dataset) Datatype() (*Datatype, error)

Datatype returns the HDF5 Datatype of the Dataset

func (*Dataset) OpenAttribute

func (s *Dataset) OpenAttribute(name string) (*Attribute, error)

Opens an existing attribute.

func (*Dataset) Read

func (s *Dataset) Read(data interface{}) error

Read reads raw data from a dataset into a buffer.

func (*Dataset) ReadSubset

func (s *Dataset) ReadSubset(data interface{}, memspace, filespace *Dataspace) error

ReadSubset reads a subset of raw data from a dataset into a buffer.

func (*Dataset) Space

func (s *Dataset) Space() *Dataspace

Space returns an identifier for a copy of the dataspace for a dataset.

func (*Dataset) Write

func (s *Dataset) Write(data interface{}) error

Write writes raw data from a buffer to a dataset.

func (*Dataset) WriteSubset

func (s *Dataset) WriteSubset(data interface{}, memspace, filespace *Dataspace) error

WriteSubset writes a subset of raw data from a buffer to a dataset.

type Dataspace

type Dataspace struct {
	Identifier
}

func CreateDataspace

func CreateDataspace(class SpaceClass) (*Dataspace, error)

CreateDataspace creates a new dataspace of a specified type.

func CreateSimpleDataspace

func CreateSimpleDataspace(dims, maxDims []uint) (*Dataspace, error)

CreateSimpleDataspace creates a new simple dataspace and opens it for access.

func (*Dataspace) Close

func (s *Dataspace) Close() error

Close releases and terminates access to a dataspace.

func (*Dataspace) Copy

func (s *Dataspace) Copy() (*Dataspace, error)

Copy creates an exact copy of a dataspace.

func (*Dataspace) Id

func (s *Dataspace) Id() int

func (*Dataspace) IsSimple

func (s *Dataspace) IsSimple() bool

IsSimple returns whether a dataspace is a simple dataspace.

func (*Dataspace) SelectHyperslab

func (s *Dataspace) SelectHyperslab(offset, stride, count, block []uint) error

SelectHyperslab creates a subset of the data space.

func (*Dataspace) SetOffset

func (s *Dataspace) SetOffset(offset []uint) error

SetOffset sets the offset of a simple dataspace.

func (*Dataspace) SimpleExtentDims

func (s *Dataspace) SimpleExtentDims() (dims, maxdims []uint, err error)

SimpleExtentDims returns dataspace dimension size and maximum size.

func (*Dataspace) SimpleExtentNDims

func (s *Dataspace) SimpleExtentNDims() int

SimpleExtentNDims returns the dimensionality of a dataspace.

func (*Dataspace) SimpleExtentNPoints

func (s *Dataspace) SimpleExtentNPoints() int

SimpleExtentNPoints returns the number of elements in a dataspace.

func (*Dataspace) SimpleExtentType

func (s *Dataspace) SimpleExtentType() SpaceClass

SimpleExtentType returns the current class of a dataspace.

type Datatype

type Datatype struct {
	Location
}
var (
	T_C_S1       *Datatype = NewDatatype(C._go_hdf5_H5T_C_S1())
	T_FORTRAN_S1 *Datatype = NewDatatype(C._go_hdf5_H5T_FORTRAN_S1())

	T_STD_I8BE  *Datatype = NewDatatype(C._go_hdf5_H5T_STD_I8BE())
	T_STD_I8LE  *Datatype = NewDatatype(C._go_hdf5_H5T_STD_I8LE())
	T_STD_I16BE *Datatype = NewDatatype(C._go_hdf5_H5T_STD_I16BE())
	T_STD_I16LE *Datatype = NewDatatype(C._go_hdf5_H5T_STD_I16LE())
	T_STD_I32BE *Datatype = NewDatatype(C._go_hdf5_H5T_STD_I32BE())
	T_STD_I32LE *Datatype = NewDatatype(C._go_hdf5_H5T_STD_I32LE())
	T_STD_I64BE *Datatype = NewDatatype(C._go_hdf5_H5T_STD_I64BE())
	T_STD_I64LE *Datatype = NewDatatype(C._go_hdf5_H5T_STD_I64LE())
	T_STD_U8BE  *Datatype = NewDatatype(C._go_hdf5_H5T_STD_U8BE())
	T_STD_U8LE  *Datatype = NewDatatype(C._go_hdf5_H5T_STD_U8LE())
	T_STD_U16BE *Datatype = NewDatatype(C._go_hdf5_H5T_STD_U16BE())
	T_STD_U16LE *Datatype = NewDatatype(C._go_hdf5_H5T_STD_U16LE())
	T_STD_U32BE *Datatype = NewDatatype(C._go_hdf5_H5T_STD_U32BE())
	T_STD_U32LE *Datatype = NewDatatype(C._go_hdf5_H5T_STD_U32LE())
	T_STD_U64BE *Datatype = NewDatatype(C._go_hdf5_H5T_STD_U64BE())
	T_STD_U64LE *Datatype = NewDatatype(C._go_hdf5_H5T_STD_U64LE())
	T_STD_B8BE  *Datatype = NewDatatype(C._go_hdf5_H5T_STD_B8BE())
	T_STD_B8LE  *Datatype = NewDatatype(C._go_hdf5_H5T_STD_B8LE())

	T_STD_B16BE       *Datatype = NewDatatype(C._go_hdf5_H5T_STD_B16BE())
	T_STD_B16LE       *Datatype = NewDatatype(C._go_hdf5_H5T_STD_B16LE())
	T_STD_B32BE       *Datatype = NewDatatype(C._go_hdf5_H5T_STD_B32BE())
	T_STD_B32LE       *Datatype = NewDatatype(C._go_hdf5_H5T_STD_B32LE())
	T_STD_B64BE       *Datatype = NewDatatype(C._go_hdf5_H5T_STD_B64BE())
	T_STD_B64LE       *Datatype = NewDatatype(C._go_hdf5_H5T_STD_B64LE())
	T_STD_REF_OBJ     *Datatype = NewDatatype(C._go_hdf5_H5T_STD_REF_OBJ())
	T_STD_REF_DSETREG *Datatype = NewDatatype(C._go_hdf5_H5T_STD_REF_DSETREG())

	T_IEEE_F32BE *Datatype = NewDatatype(C._go_hdf5_H5T_IEEE_F32BE())
	T_IEEE_F32LE *Datatype = NewDatatype(C._go_hdf5_H5T_IEEE_F32LE())
	T_IEEE_F64BE *Datatype = NewDatatype(C._go_hdf5_H5T_IEEE_F64BE())
	T_IEEE_F64LE *Datatype = NewDatatype(C._go_hdf5_H5T_IEEE_F64LE())

	T_UNIX_D32BE *Datatype = NewDatatype(C._go_hdf5_H5T_UNIX_D32BE())
	T_UNIX_D32LE *Datatype = NewDatatype(C._go_hdf5_H5T_UNIX_D32LE())
	T_UNIX_D64BE *Datatype = NewDatatype(C._go_hdf5_H5T_UNIX_D64BE())
	T_UNIX_D64LE *Datatype = NewDatatype(C._go_hdf5_H5T_UNIX_D64LE())

	T_INTEL_I8  *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_I8())
	T_INTEL_I16 *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_I16())
	T_INTEL_I32 *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_I32())
	T_INTEL_I64 *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_I64())
	T_INTEL_U8  *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_U8())
	T_INTEL_U16 *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_U16())
	T_INTEL_U32 *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_U32())
	T_INTEL_U64 *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_U64())
	T_INTEL_B8  *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_B8())
	T_INTEL_B16 *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_B16())
	T_INTEL_B32 *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_B32())
	T_INTEL_B64 *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_B64())
	T_INTEL_F32 *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_F32())
	T_INTEL_F64 *Datatype = NewDatatype(C._go_hdf5_H5T_INTEL_F64())

	T_ALPHA_I8  *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_I8())
	T_ALPHA_I16 *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_I16())
	T_ALPHA_I32 *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_I32())
	T_ALPHA_I64 *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_I64())
	T_ALPHA_U8  *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_U8())
	T_ALPHA_U16 *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_U16())
	T_ALPHA_U32 *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_U32())
	T_ALPHA_U64 *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_U64())
	T_ALPHA_B8  *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_B8())
	T_ALPHA_B16 *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_B16())
	T_ALPHA_B32 *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_B32())
	T_ALPHA_B64 *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_B64())
	T_ALPHA_F32 *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_F32())
	T_ALPHA_F64 *Datatype = NewDatatype(C._go_hdf5_H5T_ALPHA_F64())

	T_MIPS_I8  *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_I8())
	T_MIPS_I16 *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_I16())
	T_MIPS_I32 *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_I32())
	T_MIPS_I64 *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_I64())
	T_MIPS_U8  *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_U8())
	T_MIPS_U16 *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_U16())
	T_MIPS_U32 *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_U32())
	T_MIPS_U64 *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_U64())
	T_MIPS_B8  *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_B8())
	T_MIPS_B16 *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_B16())
	T_MIPS_B32 *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_B32())
	T_MIPS_B64 *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_B64())
	T_MIPS_F32 *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_F32())
	T_MIPS_F64 *Datatype = NewDatatype(C._go_hdf5_H5T_MIPS_F64())

	T_NATIVE_CHAR   *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_CHAR())
	T_NATIVE_INT    *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_INT())
	T_NATIVE_FLOAT  *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_FLOAT())
	T_NATIVE_SCHAR  *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_SCHAR())
	T_NATIVE_UCHAR  *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_UCHAR())
	T_NATIVE_SHORT  *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_SHORT())
	T_NATIVE_USHORT *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_USHORT())
	T_NATIVE_UINT   *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_UINT())
	T_NATIVE_LONG   *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_LONG())
	T_NATIVE_ULONG  *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_ULONG())
	T_NATIVE_LLONG  *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_LLONG())
	T_NATIVE_ULLONG *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_ULLONG())
	T_NATIVE_DOUBLE *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_DOUBLE())
	//#if H5_SIZEOF_LONG_DOUBLE !=0
	T_NATIVE_LDOUBLE *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_LDOUBLE())
	//#endif
	T_NATIVE_B8     *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_B8())
	T_NATIVE_B16    *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_B16())
	T_NATIVE_B32    *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_B32())
	T_NATIVE_B64    *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_B64())
	T_NATIVE_OPAQUE *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_OPAQUE())
	T_NATIVE_HSIZE  *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_HSIZE())
	T_NATIVE_HSSIZE *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_HSSIZE())
	T_NATIVE_HERR   *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_HERR())
	T_NATIVE_HBOOL  *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_HBOOL())

	T_NATIVE_INT8   *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_INT8())
	T_NATIVE_UINT8  *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_UINT8())
	T_NATIVE_INT16  *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_INT16())
	T_NATIVE_UINT16 *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_UINT16())
	T_NATIVE_INT32  *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_INT32())
	T_NATIVE_UINT32 *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_UINT32())
	T_NATIVE_INT64  *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_INT64())
	T_NATIVE_UINT64 *Datatype = NewDatatype(C._go_hdf5_H5T_NATIVE_UINT64())

	T_GO_STRING *Datatype = makeGoStringDatatype()
)

list of predefined hdf5 data types

func CreateDatatype

func CreateDatatype(class TypeClass, size int) (*Datatype, error)

CreateDatatype creates a new datatype. class must be T_COMPUND, T_OPAQUE, T_ENUM or T_STRING. size is the size of the new datatype in bytes.

func NewDataTypeFromType

func NewDataTypeFromType(t reflect.Type) (*Datatype, error)

NewDatatypeFromType creates a new Datatype from a reflect.Type.

func NewDatatype

func NewDatatype(id C.hid_t) *Datatype

NewDatatype creates a Datatype from an hdf5 id.

func NewDatatypeFromValue

func NewDatatypeFromValue(v interface{}) (*Datatype, error)

NewDatatypeFromValue creates a datatype from a value in an interface.

func OpenDatatype

func OpenDatatype(c CommonFG, name string, tapl_id int) (*Datatype, error)

OpenDatatype opens a named datatype.

func (*Datatype) Class

func (t *Datatype) Class() TypeClass

Class returns the TypeClass of the DataType

func (*Datatype) Close

func (t *Datatype) Close() error

Close releases a datatype.

func (*Datatype) Committed

func (t *Datatype) Committed() bool

Committed determines whether a datatype is a named type or a transient type.

func (*Datatype) Copy

func (t *Datatype) Copy() (*Datatype, error)

Copy copies an existing datatype.

func (*Datatype) Equal

func (t *Datatype) Equal(o *Datatype) bool

Equal determines whether two datatype identifiers refer to the same datatype.

func (*Datatype) GoType

func (t *Datatype) GoType() reflect.Type

GoType returns the reflect.Type associated with the Datatype's TypeClass

func (*Datatype) Lock

func (t *Datatype) Lock() error

Lock locks a datatype.

func (*Datatype) SetSize

func (t *Datatype) SetSize(sz uint) error

SetSize sets the total size of a Datatype.

func (*Datatype) Size

func (t *Datatype) Size() uint

Size returns the size of the Datatype.

type File

type File struct {
	CommonFG
}

a HDF5 file

func CreateFile

func CreateFile(name string, flags int) (*File, error)

Creates an HDF5 file.

func OpenFile

func OpenFile(name string, flags int) (*File, error)

Opens an existing HDF5 file.

func (*File) Close

func (f *File) Close() error

Terminates access to an HDF5 file.

func (*File) CreateTable

func (f *File) CreateTable(name string, dtype *Datatype, chunkSize, compression int) (*Table, error)

Creates a packet table to store fixed-length packets. hid_t H5PTcreate_fl( hid_t loc_id, const char * dset_name, hid_t dtype_id, hsize_t chunk_size, int compression )

func (*File) CreateTableFrom

func (f *File) CreateTableFrom(name string, dtype interface{}, chunkSize, compression int) (*Table, error)

Creates a packet table to store fixed-length packets. hid_t H5PTcreate_fl( hid_t loc_id, const char * dset_name, hid_t dtype_id, hsize_t chunk_size, int compression )

func (*File) FileName

func (f *File) FileName() string

FIXME Retrieves name of file to which object belongs. ssize_t H5Fget_name(hid_t obj_id, char *name, size_t size )

func (*File) Flush

func (f *File) Flush(scope Scope) error

Flushes all buffers associated with a file to disk. herr_t H5Fflush(hid_t object_id, H5F_scope_t scope )

func (*File) OpenTable

func (f *File) OpenTable(name string) (*Table, error)

Opens an existing packet table. hid_t H5PTopen( hid_t loc_id, const char *dset_name )

func (*File) ReOpen

func (f *File) ReOpen() (*File, error)

Returns a new identifier for a previously-opened HDF5 file.

type Group

type Group struct {
	CommonFG
}

Group is an HDF5 container object. It can contain any Location.

func (*Group) Close

func (g *Group) Close() error

Close closes the Group.

func (*Group) CreateAttribute

func (g *Group) CreateAttribute(name string, dtype *Datatype, dspace *Dataspace) (*Attribute, error)

CreateAttribute creates a new attribute at this location.

func (*Group) CreateAttributeWith

func (g *Group) CreateAttributeWith(name string, dtype *Datatype, dspace *Dataspace, acpl *PropList) (*Attribute, error)

CreateAttributeWith creates a new attribute at this location with a user-defined PropList.

func (*Group) CreateTable

func (g *Group) CreateTable(name string, dtype *Datatype, chunkSize, compression int) (*Table, error)

CreateTable creates a packet table to store fixed-length packets.

func (*Group) CreateTableFrom

func (g *Group) CreateTableFrom(name string, dtype interface{}, chunkSize, compression int) (*Table, error)

CreateTableFrom creates a packet table to store fixed-length packets.

func (*Group) OpenTable

func (g *Group) OpenTable(name string) (*Table, error)

OpenTable opens an existing packet table.

type IType

type IType C.H5I_type_t
const (
	FILE      IType = C.H5I_FILE
	GROUP     IType = C.H5I_GROUP
	DATATYPE  IType = C.H5I_DATATYPE
	DATASPACE IType = C.H5I_DATASPACE
	DATASET   IType = C.H5I_DATASET
	ATTRIBUTE IType = C.H5I_ATTR
	BAD_ID    IType = C.H5I_BADID
)

type Identifier

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

Identifier is a simple wrapper around a C hid_t. It has basic methods which apply to every type in the go-hdf5 API.

func (Identifier) File

func (i Identifier) File() *File

File returns the file associated with this Identifier.

func (Identifier) Id

func (i Identifier) Id() int

Id returns the int value of an identifier.

func (Identifier) Name

func (i Identifier) Name() string

Name returns the full name of the Identifier

func (Identifier) Type

func (i Identifier) Type() IType

Type returns the type of the identifier.

type Location

type Location struct {
	Identifier
}

A Location embeds Identifier. Dataset, Datatype and Group are all Locations.

type Object

type Object interface {
	Name() string
	Id() int
	File() *File
}

Object represents an hdf5 object.

type OpaqueDatatype

type OpaqueDatatype struct {
	Datatype
}

func (*OpaqueDatatype) SetTag

func (t *OpaqueDatatype) SetTag(tag string) error

SetTag tags an opaque datatype.

func (*OpaqueDatatype) Tag

func (t *OpaqueDatatype) Tag() string

Tag returns the tag associated with an opaque datatype.

type PropList

type PropList struct {
	Identifier
}
var (
	P_DEFAULT *PropList = newPropList(C._go_hdf5_H5P_DEFAULT())
)

func NewPropList

func NewPropList(cls_id PropType) (*PropList, error)

NewPropList creates a new PropList as an instance of a property list class.

func (*PropList) Close

func (p *PropList) Close() error

Close terminates access to a PropList.

func (*PropList) Copy

func (p *PropList) Copy() (*PropList, error)

Copy copies an existing PropList to create a new PropList.

type PropType

type PropType C.hid_t

type Scope

type Scope C.H5F_scope_t

The difference between a single file and a set of mounted files.

const (
	F_SCOPE_LOCAL  Scope = 0 // specified file handle only.
	F_SCOPE_GLOBAL Scope = 1 // entire virtual file.
)

type SpaceClass

type SpaceClass C.H5S_class_t
const (
	S_NO_CLASS SpaceClass = -1 // error
	S_SCALAR   SpaceClass = 0  // scalar variable
	S_SIMPLE   SpaceClass = 1  // simple data space
	S_NULL     SpaceClass = 2  // null data space
)

type Table

type Table struct {
	Location
}

Table is an hdf5 packet-table.

func (*Table) Append

func (t *Table) Append(data interface{}) error

Append appends packets to the end of a packet table.

func (*Table) Close

func (t *Table) Close() error

Close closes an open packet table.

func (*Table) CreateIndex

func (t *Table) CreateIndex() error

CreateIndex resets a packet table's index to the first packet.

func (*Table) Id

func (t *Table) Id() int

func (*Table) IsValid

func (t *Table) IsValid() bool

IsValid returns whether or not an indentifier points to a packet table.

func (*Table) Next

func (t *Table) Next(data interface{}) error

Next reads packets from a packet table starting at the current index into the value pointed at by data. i.e. data is a pointer to an array or a slice.

func (*Table) NumPackets

func (t *Table) NumPackets() (int, error)

NumPackets returns the number of packets in a packet table.

func (*Table) ReadPackets

func (t *Table) ReadPackets(start, nrecords int, data interface{}) error

ReadPackets reads a number of packets from a packet table.

func (*Table) SetIndex

func (t *Table) SetIndex(index int) error

SetIndex sets a packet table's index.

func (*Table) Type

func (t *Table) Type() (*Datatype, error)

Type returns an identifier for a copy of the datatype for a dataset.

type TypeClass

type TypeClass C.H5T_class_t
const (
	T_NO_CLASS  TypeClass = -1 // Error
	T_INTEGER   TypeClass = 0  // integer types
	T_FLOAT     TypeClass = 1  // floating-point types
	T_TIME      TypeClass = 2  // date and time types
	T_STRING    TypeClass = 3  // character string types
	T_BITFIELD  TypeClass = 4  // bit field types
	T_OPAQUE    TypeClass = 5  // opaque types
	T_COMPOUND  TypeClass = 6  // compound types
	T_REFERENCE TypeClass = 7  // reference types
	T_ENUM      TypeClass = 8  // enumeration types
	T_VLEN      TypeClass = 9  // variable-length types
	T_ARRAY     TypeClass = 10 // array types
	T_NCLASSES  TypeClass = 11 // nbr of classes -- MUST BE LAST
)

type VarLenType

type VarLenType struct {
	Datatype
}

func NewVarLenType

func NewVarLenType(base_type *Datatype) (*VarLenType, error)

NewVarLenType creates a new VarLenType. base_type specifies the element type of the VarLenType.

func (*VarLenType) IsVariableStr

func (vl *VarLenType) IsVariableStr() bool

IsVariableStr determines whether the VarLenType is a string.

type Version

type Version struct {
	Major   uint
	Minor   uint
	Release uint
}

Version represents the currently used hdf5 library version

func LibVersion

func LibVersion() (Version, error)

LibVersion returns version information for the HDF5 library.

func (Version) String

func (v Version) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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