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§
- Analysis
OrForecast Template - Product Definition Template 4.0: analysis or forecast at a horizontal level.
- Binary
Data Section - Complex
Packing Params - Parameters for complex packing (Templates 5.2 and 5.3).
- Ensemble
Statistical Process Template - Product Definition Template 4.11: individual ensemble forecast over a time interval.
- Fixed
Surface - A fixed surface from Product Definition templates.
- Grib1
Product Definition - GRIB1 product definition metadata.
- Grib
File - A GRIB file containing one or more logical fields.
- Grid
Description - Identification
- Section 1: Identification Section.
- Image
Packing Params - Parameters shared by image-backed grid point packing templates.
- Individual
Ensemble Forecast Template - Product Definition Template 4.1: individual ensemble forecast at a point in time.
- Jpeg2000
Packing Params - Parameters for JPEG 2000 code stream packing (Template 5.40).
- Lambert
Conformal Grid - Template 3.30: Lambert conformal grid.
- LatLon
Grid - Template 3.0: Regular latitude/longitude grid.
- Local
Parameter Entry - A user-authored or built-in GRIB2 local table entry.
- Local
Parameter Table - Owned GRIB2 local parameter table with file-authoring helpers.
- Message
- A single logical GRIB field.
- Message
Iter - Iterator over fields in a GRIB file.
- Message
Metadata - A parsed GRIB field.
- Open
Options - Configuration for opening GRIB data.
- Owned
Local Parameter Entry - Owned local table entry for authoring or loading table files.
- Parameter
- Edition-independent parameter identity.
- PngPacking
Params - Parameters for PNG image packing (Template 5.41).
- Polar
Stereographic Grid - Template 3.20: Polar stereographic projection.
- Predefined
Bitmap - Caller-supplied GRIB1 predefined bitmap.
- Product
Definition - Section 4: Product Definition Section.
- Reference
Time - Common reference time representation for GRIB fields.
- Simple
Packing Params - Parameters for simple packing (Template 5.0).
- Spatial
Differencing Params - Parameters specific to template 5.3 spatial differencing.
- Statistical
Process Template - Product Definition Template 4.8: statistically processed field over a time interval.
- Statistical
Time Range - Statistical processing descriptor from GRIB2 Product Definition templates with one or more time range specifications.
Enums§
- Data
Representation - Data representation template number and parameters.
- Error
- Forecast
Time Unit - Semantic forecast-time units shared across GRIB editions.
- Grid
Definition - Grid definition extracted from Section 3.
- Parameter
Table Source - Source table used to resolve a parameter name.
- Product
Definition Template - 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.