Documentation
¶
Overview ¶
Package grib2hrrr decodes NOAA HRRR GRIB2 files using GDT 3.30 (Lambert conformal) grids and DRS Template 5.3 (complex packing + spatial differencing).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DRS0Params ¶ added in v0.3.0
type DRS0Params struct {
ReferenceValue float64
BinaryScaleFactor int
DecimalScaleFactor int
Nbits int
TypeOfValue byte
N int // number of data points from sec[5:9]
}
DRS0Params holds parameters from DRS Template 5.0 (grid point, simple packing).
type DRS53Params ¶
type DRS53Params struct {
ReferenceValue float64
BinaryScaleFactor int
DecimalScaleFactor int
Nbits int // bits per group reference value
TypeOfValue byte
SplittingMethod byte
MissingMgmt byte
PrimaryMissing float64
SecondaryMissing float64
NG int // number of groups
RefGroupWidth int
BitsGroupWidth int
RefGroupLength uint32
LengthIncrement byte
LenLastGroup uint32
BitsGroupLength int
OrderSpatialDiff int
NOctetsExtra int
}
DRS53Params holds all parameters from DRS Template 5.3.
type Field ¶
type Field struct {
Grid LambertGrid
Vals []float64
}
Field is a decoded GRIB2 field: a Lambert conformal grid + float64 values. Values are stored row-major: vals[j*Grid.Ni + i].
func DecodeMessage ¶
DecodeMessage decodes a raw GRIB2 message (all sections) into a Field.
type HRRRClient ¶
type HRRRClient struct {
HTTPClient *http.Client
BaseURL string // default: "https://noaa-hrrr-bdp-pds.s3.amazonaws.com"
}
HRRRClient fetches HRRR GRIB2 messages from the NOAA S3 bucket.
func NewHRRRClient ¶
func NewHRRRClient() *HRRRClient
NewHRRRClient returns a client with sensible defaults.
func (*HRRRClient) FetchField ¶
func (c *HRRRClient) FetchField(ctx context.Context, t time.Time, fxx int, varLevel string) (*Field, error)
FetchField fetches and decodes a single GRIB2 field by variable/level. t is the model run time (UTC), fxx is the forecast hour (0-48). varLevel is an index search string, e.g. "TMP:700 mb". Issue #6: ctx is propagated to all HTTP calls so callers can cancel in-flight requests.
type LambertGrid ¶
type LambertGrid struct {
Ni, Nj int
La1, Lo1 float64 // first grid point, signed degrees (La1 SW corner)
LoV float64 // central meridian, signed degrees
Latin1, Latin2 float64 // standard parallels, degrees
Dx, Dy float64 // grid spacing, metres
ScanMode byte
}
LambertGrid holds parsed GDT 3.30 parameters.
func (*LambertGrid) IjToLatLon ¶
func (g *LambertGrid) IjToLatLon(i, j int) (lat, lon float64)
IjToLatLon maps grid indices (i,j) → (lat°N, lon°E signed).
func (*LambertGrid) LatLonToIJ ¶
func (g *LambertGrid) LatLonToIJ(lat, lon float64) (i, j int)
LatLonToIJ maps (lat°N, lon°E signed) → nearest grid indices (i,j). i increases eastward, j increases northward (scanning mode 0x40).
type Section3 ¶
type Section3 struct {
Grid LambertGrid
}
Section3 holds GDT 3.30 Lambert conformal grid parameters decoded from HRRR. HRRR uses a non-standard compact form: no basic-angle/subdivisions fields, but adds a LaD field between ResolutionFlags and LoV.