package
1.2.12
Repository: https://github.com/cpmech/gosl.git
Documentation: pkg.go.dev

# README

Gosl. hb. Read/Write hb (go-binary gob) files

Go Reference

This package is inspired by the Hierarchical Data File (HDF) format but uses go-binary (gob) stream of gobs instead.

Data is stored in binary streams and then to files by providing a path and the data. Here, the order of commands is important.

Example of writing data:

f := Create("/tmp/gosl/hb", "basic01")
defer f.Close()
f.PutArray("/u", uSource)
f.PutArray("/displacements/u", []float64{4, 5, 6})
f.PutArray("/displacements/v", []float64{40, 50, 60})
f.PutArray("/time0/ip0/a0/u", []float64{7, 8, 9})
f.PutArray("/time1/ip0/b0/u", []float64{70, 80, 90})
f.PutInts("/someints", []int{100, 200, 300, 400})
f.PutInt("/data/oneint", 123)
f.PutFloat64("/data/onef64", 123.456)

Example of reading data (must be in the same order used during writing):

g := Open("/tmp/gosl/hb", "basic01")
defer g.Close()
u := g.GetArray("/u")
du := g.GetArray("/displacements/u")
dv := g.GetArray("/displacements/v")
t0i0a0u := g.GetArray("/time0/ip0/a0/u")
t1i0b0u := g.GetArray("/time1/ip0/b0/u")
someints := g.GetInts("/someints")
oneint := g.GetInt("/data/oneint")
onef64 := g.GetFloat64("/data/onef64")

API

Please see the documentation here

# Functions

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.
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.

# Structs

File represents a HDF5 file.