Skip to content

ready-steady/hdf5

Repository files navigation

HDF5 Build Status

The package provides a reader and writer of HDF5 files.

Installation

Fetch the package:

go get -d github.com/ready-steady/hdf5

Go to the directory of the package:

cd $GOPATH/src/github.com/ready-steady/hdf5

Install the package:

make install

Usage

package main

import (
	"fmt"

	"github.com/ready-steady/hdf5"
)

func main() {
	put("data.h5")
	get("data.h5")
}

func put(path string) {
	file, _ := hdf5.Create(path)
	defer file.Close()

	A := 42
	file.Put("A", A)

	B := []float64{1, 2, 3}
	file.Put("B", B)

	C := struct {
		D int
		E []float64
	}{
		D: 42,
		E: []float64{1, 2, 3},
	}
	file.Put("C", C)
}

func get(path string) {
	file, _ := hdf5.Open(path)
	defer file.Close()

	A := 0
	file.Get("A", &A)
	fmt.Println(A)

	B := []float64{}
	file.Get("B", &B)
	fmt.Println(B)

	C := struct {
		D int
		E []float64
	}{}
	file.Get("C", &C)
	fmt.Println(C)
}

Contribution

  1. Fork the project.
  2. Implement your idea.
  3. Open a pull request.

Releases

No releases published

Packages

No packages published