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 with simple packing.

§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 error::Error;
pub use error::Result;
pub use metadata::Parameter;
pub use metadata::ReferenceTime;
pub use product::FixedSurface;
pub use product::Identification;
pub use product::ProductDefinition;

Modules§

data
Data Representation Section (Section 5) and Data Section (Section 7) decoding.
error
grib1
GRIB Edition 1 parsing.
grid
Grid Definition Section (Section 3) parsing.
indicator
Section 0: Indicator Section parsing for GRIB1 and GRIB2.
metadata
Edition-independent field metadata.
parameter
WMO parameter tables (Code Table 4.2) for GRIB2.
product
GRIB2 metadata carried by Sections 1 and 4.
sections
GRIB2 section scanning and logical field indexing.

Structs§

GribFile
A GRIB file containing one or more logical fields.
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.