This file documents the common cli usage and examples for extracting timeseries from GRIB2 files.
--probe <lon> <lat> <file.grib2>— probe a single file and print available keys and values at the point--timeseries <param[,param,...]>— request one or multiple timeseries parameters (e.g.,2t,tp,msl)--init YYYYmmddHH— initial time used to match files and to compute timestamps--lon <lon>--lat <lat>— probe location--data-dir <dir>— directory containing GRIB2 files--out-json <file>— write results in JSON format--out-csv <file>— write results in CSV format--verbose/-v— print debug information
--out-json <file>now writes only JSON and will not implicitly create a CSV file.--out-csv <file>explicitly creates CSV output. CSV is generated from the same aligned timeseries data as JSON so the values are consistent between formats.tpsvalues are included only when thetpparameter is requested (either alone or as part of a comma-separated list). When present:- JSON: each row will have a
tpsfield (in mm) computed from cumulativetpvalues (first entry = 0.0, second = first cumulative, subsequent = differences). - CSV: an extra
tpscolumn is appended (same values as JSON per-row tps).
- JSON: each row will have a
- Probe a single file:
cargo run --bin gribextractor -- --probe 88.363 12.962 ./gribfiles/2t_2025122900_000-024.grib2- Single-parameter timeseries printed to console:
cargo run --bin gribextractor -- --timeseries 2t --init 2025122900 --lon 88.363 --lat 12.962 --data-dir gribfiles- Generate JSON only:
cargo run --bin gribextractor -- --timeseries 2t,tp --init 2025122900 --lon 88.363 --lat 12.962 --data-dir gribfiles --out-json out.jsonThe produced out.json will include tps fields because tp was requested.
- Generate CSV only:
cargo run --bin gribextractor -- --timeseries 2t,tp,msl,10u,10v --init 2025122900 --lon 113.363 --lat 22.962 --data-dir D:\work\realtimeforecast\2025122900 --out-csv out.csvThe produced out.csv will include an extra tps column when tp is in the requested list.
- Generate both JSON and CSV:
cargo run --bin gribextractor -- --timeseries 2t,tp --init 2025122900 --lon 88.363 --lat 12.962 --data-dir gribfiles --out-json out.json --out-csv out.csv- Request a non-
tpparam (notpsshould be present):
cargo run --bin gribextractor -- --timeseries 2t --init 2025122900 --lon 88.363 --lat 12.962 --data-dir gribfiles --out-json out2.jsonout2.json will not contain tps fields because tp was not requested.
- The timeseries alignment and
tpscomputation have been factored into a reusable internal modulegribextractor::timeseries::build_aligned_timeseriesso CSV and JSON outputs are generated from the same data source (JSON is used as the authoritative format). - If you want me to add examples showing how to read the JSON output programmatically or add more documentation about the internal API, I can add that too.
Happy data extracting! 🚀