Skip to main content

Crate grib_reader

Crate grib_reader 

Source
Expand description

Pure-Rust GRIB file reader.

The current implementation supports the production-critical baseline for both GRIB1 and GRIB2: regular latitude/longitude grids, GRIB2 Lambert conformal and polar stereographic metadata and flat decode, simple packing, GRIB2 complex packing with general group splitting, and optional image-backed GRIB2 packing codecs.

§Example

use grib_reader::GribFile;

let file = GribFile::open("gfs.grib2")?;
println!("messages: {}", file.message_count());

for msg in file.messages() {
    println!(
        "  {} {:?} {:04}-{:02}-{:02}T{:02}:{:02}:{:02}Z",
        msg.parameter_name(),
        msg.grid_shape(),
        msg.reference_time().year,
        msg.reference_time().month,
        msg.reference_time().day,
        msg.reference_time().hour,
        msg.reference_time().minute,
        msg.reference_time().second,
    );
}

let data = file.message(0)?.read_data_as_f64()?;
println!("shape: {:?}", data.shape());

Re-exports§

pub use data::DecodeSample;

Modules§

data
Data Section (Section 7) decoding.
error
grib1
GRIB Edition 1 parsing.
grid
indicator
Section 0: Indicator Section parsing for GRIB1 and GRIB2.
metadata
parameter
product
sections
GRIB2 section scanning and logical field indexing.

Structs§

AnalysisOrForecastTemplate
Product Definition Template 4.0: analysis or forecast at a horizontal level.
BinaryDataSection
ComplexPackingParams
Parameters for complex packing (Templates 5.2 and 5.3).
EnsembleStatisticalProcessTemplate
Product Definition Template 4.11: individual ensemble forecast over a time interval.
FixedSurface
A fixed surface from Product Definition templates.
Grib1ProductDefinition
GRIB1 product definition metadata.
GribFile
A GRIB file containing one or more logical fields.
GridDescription
Identification
Section 1: Identification Section.
ImagePackingParams
Parameters shared by image-backed grid point packing templates.
IndividualEnsembleForecastTemplate
Product Definition Template 4.1: individual ensemble forecast at a point in time.
Jpeg2000PackingParams
Parameters for JPEG 2000 code stream packing (Template 5.40).
LambertConformalGrid
Template 3.30: Lambert conformal grid.
LatLonGrid
Template 3.0: Regular latitude/longitude grid.
LocalParameterEntry
A user-authored or built-in GRIB2 local table entry.
LocalParameterTable
Owned GRIB2 local parameter table with file-authoring helpers.
Message
A single logical GRIB field.
MessageIter
Iterator over fields in a GRIB file.
MessageMetadata
A parsed GRIB field.
OpenOptions
Configuration for opening GRIB data.
OwnedLocalParameterEntry
Owned local table entry for authoring or loading table files.
Parameter
Edition-independent parameter identity.
PngPackingParams
Parameters for PNG image packing (Template 5.41).
PolarStereographicGrid
Template 3.20: Polar stereographic projection.
PredefinedBitmap
Caller-supplied GRIB1 predefined bitmap.
ProductDefinition
Section 4: Product Definition Section.
ReferenceTime
Common reference time representation for GRIB fields.
SimplePackingParams
Parameters for simple packing (Template 5.0).
SpatialDifferencingParams
Parameters specific to template 5.3 spatial differencing.
StatisticalProcessTemplate
Product Definition Template 4.8: statistically processed field over a time interval.
StatisticalTimeRange
Statistical processing descriptor from GRIB2 Product Definition templates with one or more time range specifications.

Enums§

DataRepresentation
Data representation template number and parameters.
Error
ForecastTimeUnit
Semantic forecast-time units shared across GRIB editions.
GridDefinition
Grid definition extracted from Section 3.
ParameterTableSource
Source table used to resolve a parameter name.
ProductDefinitionTemplate
Typed GRIB2 Product Definition templates.

Constants§

BUILTIN_LOCAL_PARAMETERS
Built-in local table entries shipped with the crate.
DEFAULT_MAX_AXIS_POINTS
DEFAULT_MAX_DECODED_POINTS
LOCAL_PARAMETER_TABLE_CSV_HEADER
Header for the line-oriented local parameter table CSV format.

Type Aliases§

Result