Expand description
Pure-Rust GRIB file reader.
The reader supports GRIB1 and GRIB2 regular geographic grids, GRIB2 rotated latitude/longitude, regular Gaussian, and common projected grids, simple and complex and IEEE packing, multi-field bitmap reuse, bounded allocation, and optional image-backed and CCSDS packing codecs.
Missing grid points from bitmaps and embedded complex-packing codes decode
as NaN. Complex-packing substitute metadata remains available through
ComplexPackingParams::primary_missing_substitute and
ComplexPackingParams::secondary_missing_substitute for callers that
need producer-specific replacement values.
§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§
- Albers
Equal Area Grid - Template 3.31: Albers equal-area grid.
- Analysis
OrForecast Template - Product Definition Template 4.0: analysis or forecast at a horizontal level.
- Binary
Data Section - Ccsds
Block Size - Number of samples in a CCSDS/AEC coding block.
- Ccsds
Flags - CCSDS/AEC option mask stored by data representation template 5.42.
- Ccsds
Packing Params - Validated parameters for CCSDS 121.0 packing (template 5.42).
- Complex
Packing Params - Parameters for complex packing (Templates 5.2 and 5.3).
- Derived
Forecast Template - Product Definition Template 4.2: forecast derived from all ensemble members.
- Derived
Statistical Process Template - Product Definition Template 4.12: derived ensemble forecast over a time interval.
- 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.
- Grib1
Second Order Packing Params - Validated parameters for standard GRIB1 grid-point second-order packing.
- Grib
File - A GRIB file containing one or more logical fields.
- Grib
File Builder - Builder for opening GRIB data with explicit scanning, allocation, and center-defined metadata policies.
- Grid
Description - Identification
- Section 1: Identification Section.
- Ieee
Packing Params - Parameters for IEEE floating-point packing (Template 5.4).
- 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.
- Mercator
Grid - Template 3.10: Mercator grid.
- Message
- A single logical GRIB field.
- Message
Iter - Iterator over fields in a GRIB file.
- Message
Metadata - A parsed GRIB field.
- Owned
Local Parameter Entry - Owned local table entry for authoring or loading table files.
- Parameter
- Edition-independent parameter identity.
- Percentile
Forecast Template - Product Definition Template 4.6: percentile forecast at a point in time.
- Percentile
Statistical Process Template - Product Definition Template 4.10: percentile forecast over a time interval.
- 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.
- Probability
Forecast Template - Product Definition Template 4.5: probability forecast at a point in time.
- Probability
Limit - A signed decimal threshold used by probability product templates.
- Probability
Statistical Process Template - Product Definition Template 4.9: probability forecast over a time interval.
- Product
Definition - Section 4: Product Definition Section.
- Projected
Grid Core - Fields shared by all supported projected grid templates.
- Reference
Time - Common reference time representation for GRIB fields.
- Regular
Gaussian Grid - Template 3.40: regular Gaussian latitude/longitude grid.
- Rotated
LatLon Grid - Template 3.1: rotated latitude/longitude grid.
- RunLength
Packing Params - Parameters for run-length packing with level values (Template 5.200).
- Scaled
Packing Params - Scaling parameters shared by GRIB1 and GRIB2 grid-point packing.
- Scaled
Value - The scale/value pair used to encode a fixed-surface numeric level.
- Spatial
Differencing Params - Parameters specific to template 5.3 spatial differencing.
- Spatial
Process Template - Product Definition Template 4.15: statistical processing over a spatial area.
- Statistical
Interval - Time-interval metadata shared by statistically processed product templates.
- 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 - GRIB data representation and validated packing parameters.
- Error
- Forecast
Time Unit - Semantic forecast-time units shared across GRIB editions.
- Grib1
Second Order Layout - Standard GRIB1 second-order group layout.
- Grid
Definition - Grid definition extracted from Section 3.
- Ieee
Precision - IEEE floating-point precision from Code Table 5.7.
- Parameter
Table Source - Source table used to resolve a parameter name.
- Probability
Type - The event whose forecast probability is encoded by templates 4.5 and 4.9.
- 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.
- MISSING_
INCREMENT - Encoded value of a grid increment that the grid section does not give.