Struct grib::Parameter

source ·
pub struct Parameter {
    pub discipline: u8,
    pub centre: u16,
    pub master_ver: u8,
    pub local_ver: u8,
    pub category: u8,
    pub num: u8,
}
Expand description

Parameter of the product.

In the context of GRIB products, parameters refer to weather elements such as air temperature, air pressure, and humidity, and other physical quantities.

With is_identical_to, users can check if the parameter is identical to a third-party code, such as NCEP.

Fields§

§discipline: u8

Discipline of processed data in the GRIB message.

§centre: u16

GRIB master tables version number.

§master_ver: u8

Parameter category by product discipline.

§local_ver: u8

GRIB local tables version number.

§category: u8

Identification of originating/generating centre.

§num: u8

Parameter number by product discipline and parameter category.

Implementations§

source§

impl Parameter

source

pub fn description(&self) -> Option<String>

Looks up the parameter’s WMO description.

§Examples
// Extracted from the first submessage of JMA MSM GRIB2 data.
let param = grib::Parameter {
    discipline: 0,
    centre: 34,
    master_ver: 2,
    local_ver: 1,
    category: 3,
    num: 5,
};
assert_eq!(param.description(), Some("Geopotential height".to_owned()))
source

pub fn is_identical_to<'a, T>(&'a self, code: T) -> bool

Checks if the parameter is identical to a third-party code, such as NCEP.

§Examples
use grib::codetables::NCEP;

// Extracted from the first submessage of JMA MSM GRIB2 data.
let param = grib::Parameter {
    discipline: 0,
    centre: 34,
    master_ver: 2,
    local_ver: 1,
    category: 3,
    num: 5,
};
assert!(param.is_identical_to(NCEP::HGT));

Trait Implementations§

source§

impl Debug for Parameter

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for Parameter

source§

fn eq(&self, other: &Parameter) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<&Parameter> for NCEP

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_from(value: &Parameter) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for Parameter

source§

impl StructuralPartialEq for Parameter

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.