-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.go
More file actions
33 lines (28 loc) · 732 Bytes
/
main.go
File metadata and controls
33 lines (28 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main
import (
"fmt"
"log"
"github.com/scigolib/hdf5"
)
func main() {
file, err := hdf5.Open("../testdata/simple_float64.h5")
if err != nil {
log.Fatalf("Failed to open file: %v", err)
}
defer func() { _ = file.Close() }()
fmt.Println("Superblock version:", file.SuperblockVersion())
fmt.Println("\nObjects in file:")
file.Walk(func(path string, obj hdf5.Object) {
switch v := obj.(type) {
case *hdf5.Group:
fmt.Printf(" Group: %s (children: %d)\n", path, len(v.Children()))
for _, child := range v.Children() {
fmt.Printf(" - %s\n", child.Name())
}
case *hdf5.Dataset:
fmt.Printf(" Dataset: %s\n", path)
default:
fmt.Printf(" Unknown: %s (type: %T)\n", path, obj)
}
})
}