noritada / grib-rs

GRIB format parser for Rust
Apache License 2.0
57 stars 9 forks source link

Submessage filtering improvement part 2: more user-friendly API to check the identity of numerical parameters and named codes #100

Closed noritada closed 2 months ago

noritada commented 2 months ago

This PR provides a more user-friendly API to check the identity of numerical parameters and named codes.

With this API, users are now able to check the identity like this:

param.is_identical_to(NCEP::HGT)

So, submessage filtering can be done like this:

grib2.iter().find(|submessage| {
    submessage.parameter().is_some_and(|param| param.is_identical_to(NCEP::HGT))
});