rust-grib-decoder 0.1.0

Utilities to decode GRIB2 CCSDS/AEC (template 5.0=42) payloads and extract Section 7 payloads per message.
Documentation

rust-grib-decoder

crates.io docs.rs license

Utilities to decode GRIB2 CCSDS/AEC (template 5.0=42) payloads and to extract Section 7 payloads on a per-message basis.

This crate provides a small, focused set of helpers useful for tooling and CLI utilities:

  • read_grib2_section7_payloads_by_message(path: &Path) -> Result<Vec<Vec<u8>>, String>
  • read_first_grib2_section7_payload(path: &Path) -> Result<Vec<u8>, String>
  • read_grib2_section5_template42_params_by_message(path: &Path) -> Result<Vec<Option<Template42Params>>, String>
  • decode_template42_rust_from_params_with_payload(...) (pure-Rust rust-aec decoder)
  • probe_all_fields_at_lat_lon(path, lat, lon) — convenience probe helper
  • summarize_file(path) -> FileSummary and find_candidates_for_param(path, param) — CLI diagnostics helpers

Quickstart ✨

Add to your Cargo.toml (crates.io):

rust-grib-decoder = "0.1"

For local/workspace development use the path override:

# Local development

# rust-grib-decoder = { path = "crates/rust-grib-decoder", default-features = true }

Usage example

use std::path::Path;
use rust_grib_decoder::{read_first_grib2_latlon_grid, decode_template42_first_message};

let path = Path::new("data.grib2");
let grid = read_first_grib2_latlon_grid(path)?;
if let Ok(Some(values)) = decode_template42_first_message(path, grid.ni, grid.nj) {
    println!("Decoded {} samples ({}x{})", values.len(), grid.ni, grid.nj);
}

Documentation & publishing

Before publishing, ensure repository and authors in Cargo.toml are set and a LICENSE file is present.


(See examples/ for runnable examples. This crate includes an extract_param example that shows how to summarize a file, find candidate messages for a parameter like msl or 2t, and decode an interpolated value at a lon/lat: cargo run -p rust-grib-decoder --example extract_param -- file.grib2 msl 113.363 22.962.)