GRIB2 library for Go programming language (golang)
Parse GRIB2 files using Golang
History
Currently in need of a parser for GRIB Edition 2 (GRIB2) we found the most an up-to-date repo in amsokol/go-grib2. Nevertheless, the last commit date from 2 feb 2018 and we felt the need to maintain it.
amsokol/go-grib2 did a great work in:
- Porting wgrib2 from C to Go
- Made
wgrib2
thread-safe, by removing a lot of global read/write variables inside code
- Applied new features and patches from original
wgrib2
development stream
How-to
go get -u github.com/sdifrance/go-grib2
It contains only one function that parses GRIB2 file:
func Read(data []byte) ([]GRIB2, error)
where GRIB2
is the structure with parsed data:
// GRIB2 simplified file structure
type GRIB2 struct {
RefTime time.Time
VerfTime time.Time
Name string
Description string
Unit string
Level string
Values []Value
}
// Value is data item of GRIB2 file
type Value struct {
Longitude float64
Latitude float64
Value float32
}
See the following usage examples:
Previous Known Issues
go-grib2
does not support jpeg
, png
and aec
data package formats. The reason is wgrib2
uses external C
libraries to parse these formats. If you have an idea how to easy port jpeg
, png
and aec
please let me know.
Contributions are Welcome
The main axis for development will be: