grib/codetables/
external.rs1use num_enum::{IntoPrimitive, TryFromPrimitive};
2
3use crate::Parameter;
4
5#[derive(Debug, Eq, PartialEq, Clone, TryFromPrimitive, IntoPrimitive)]
6#[repr(u32)]
7pub enum NCEP {
9 PRES = 0x_00_03_00,
11 PRMSL = 0x_00_03_01,
13 HGT = 0x_00_03_05,
15}
16
17impl TryFrom<&Parameter> for NCEP {
18 type Error = &'static str;
19
20 fn try_from(value: &Parameter) -> Result<Self, Self::Error> {
21 let code = value.as_u32();
22 Self::try_from_primitive(code).map_err(|_| "code not found")
23 }
24}