grib2

package module
v0.0.0-...-816e6d6 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

README

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:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRIB2

type GRIB2 struct {
	RefTime     time.Time
	VerfTime    time.Time
	Name        string
	Description string
	Unit        string
	Level       string
	Values      []Value
}

GRIB2 is simplified GRIB2 file structure

func Read

func Read(data []byte) ([]GRIB2, error)

Read reads raw GRIB2 files and return slice of structured GRIB2 data

type Value

type Value struct {
	Longitude float64
	Latitude  float64
	Value     float32
}

Value is data item of GRIB2 file

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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