forked from gsn/predictor
updated downloader
This commit is contained in:
parent
ca95e06ab7
commit
8e9f117799
30 changed files with 1209 additions and 698 deletions
38
scripts/test_grib_read.go
Normal file
38
scripts/test_grib_read.go
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/nilsmagnus/grib/griblib"
|
||||
)
|
||||
|
||||
func main() {
|
||||
f, err := os.Open("C:/tmp/grib/gfs.t18z.pgrb2.0p25.f000")
|
||||
if err != nil {
|
||||
fmt.Printf("Error opening file: %v\n", err)
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
messages, err := griblib.ReadMessages(f)
|
||||
if err != nil {
|
||||
fmt.Printf("Error reading GRIB: %v\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("Found %d messages\n\n", len(messages))
|
||||
|
||||
for i, m := range messages {
|
||||
product := m.Section4.ProductDefinitionTemplate
|
||||
if product.ParameterCategory != 2 || product.ParameterNumber != 2 {
|
||||
continue // only u-wind
|
||||
}
|
||||
fmt.Printf("UGRD Msg %d: SurfType=%d SurfValue=%d SurfScale=%d DataLen=%d\n",
|
||||
i,
|
||||
product.FirstSurface.Type,
|
||||
product.FirstSurface.Value,
|
||||
product.FirstSurface.Scale,
|
||||
len(m.Data()))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue