gistools/readers/grib2/sections/_2/
mod.rs

1use crate::parsers::{BufferReader, Reader};
2
3/// # SECTION 2 - LOCAL USE SECTION
4///
5/// ## Notes
6/// 1. Center=7 (NCEP), subcenter=14(NWS Meteorological Development Laboratory (MDL))
7///    used octet 6 to indicate which local use table to use. For MDL, octet 6=1 indicates use:
8///    "MDL Template 2.1"
9///
10/// ## Links
11/// - [Read more...](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_sect2.shtml)
12#[derive(Debug, Clone, PartialEq)]
13pub struct Grib2LocalUseSection {
14    /// Number of GRIB section
15    pub section_number: u8,
16    /// Length of GRIB section
17    pub length: u32,
18    /// Section 2 Contents
19    pub contents: BufferReader,
20}
21impl Grib2LocalUseSection {
22    /// Create a new Grib2LocalUseSection
23    ///
24    /// ## Parameters
25    /// - `section`: The byte block to pull basic local information
26    ///
27    /// ## Returns
28    /// A parsed explaination of local use.
29    pub fn new<T: Reader>(section: &T) -> Grib2LocalUseSection {
30        Grib2LocalUseSection {
31            section_number: section.uint8(Some(4)),
32            length: section.uint32_be(Some(0)),
33            contents: BufferReader::new(section.slice(Some(5), None)),
34        }
35    }
36}