Skip to main content

Template3_10

Struct Template3_10 

Source
pub struct Template3_10 {
Show 13 fields pub earth_shape: EarthShape, pub ni: u32, pub nj: u32, pub first_point_lat: i32, pub first_point_lon: u32, pub resolution_and_component_flags: ResolutionAndComponentFlags, pub lad: i32, pub last_point_lat: i32, pub last_point_lon: u32, pub scanning_mode: ScanningMode, pub orientation: u32, pub di: u32, pub dj: u32,
}
Expand description

Grid definition template 3.10 - Mercator.

§Examples

use std::io::{BufReader, Read};

use grib::{
    TryFromSlice,
    def::grib2::template::{Template3_10, param_set},
};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut buf = Vec::new();

    let f = std::fs::File::open("testdata/ds.wwa.bin.xz")?;
    let f = BufReader::new(f);
    let mut f = xz2::bufread::XzDecoder::new(f);
    f.read_to_end(&mut buf)?;

    let mut pos = 0xa6;
    let actual = Template3_10::try_from_slice(&buf, &mut pos)?;
    let expected = Template3_10 {
        earth_shape: param_set::EarthShape {
            shape: 1,
            spherical_earth_radius: param_set::ScaledValue {
                scale_factor: 0,
                scaled_value: 6371200,
            },
            major_axis: param_set::ScaledValue {
                scale_factor: 0,
                scaled_value: 0,
            },
            minor_axis: param_set::ScaledValue {
                scale_factor: 0,
                scaled_value: 0,
            },
        },
        ni: 2517,
        nj: 1793,
        first_point_lat: -30419200,
        first_point_lon: 129906005,
        resolution_and_component_flags: param_set::ResolutionAndComponentFlags(0b00000000),
        lad: 20000000,
        last_point_lat: 80010000,
        last_point_lon: 10710000,
        scanning_mode: param_set::ScanningMode(0b01010000),
        orientation: 0,
        di: 10000000,
        dj: 10000000,
    };
    assert_eq!(actual, expected);

    Ok(())
}

Fields§

§earth_shape: EarthShape§ni: u32

Ni - number of points along a parallel.

§nj: u32

Nj - number of points along a meridian.

§first_point_lat: i32

La1 - latitude of first grid point.

§first_point_lon: u32

Lo1 - longitude of first grid point.

§resolution_and_component_flags: ResolutionAndComponentFlags§lad: i32

LaD - Latitude(s) at which the Mercator projection intersects the Earth (Latitude(s) where Di and Dj are specified).

§last_point_lat: i32

La2 - latitude of last grid point.

§last_point_lon: u32

Lo2 - longitude of last grid point.

§scanning_mode: ScanningMode§orientation: u32

Orientation of the grid, angle between i direction on the map and the equator (see Note 1).

§di: u32

Di - longitudinal direction grid length (see Note 2).

§dj: u32

Dj - latitudinal direction grid length (see Note 2).

Trait Implementations§

Source§

impl Clone for Template3_10

Source§

fn clone(&self) -> Template3_10

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Template3_10

Source§

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

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

impl Dump for Template3_10

Source§

fn dump<'d, W: Write>( &self, parent: Option<&Cow<'_, str>>, doc_overrides: DocOverrides<'d>, pos: &mut usize, output: &mut W, ) -> Result<(), Error>

Perform dumping to output. Read more
Source§

impl Eq for Template3_10

Source§

impl GridPointIndex for Template3_10

Source§

fn grid_shape(&self) -> (usize, usize)

Returns the shape of the grid, i.e. a tuple of the number of grids in the i and j directions.
Source§

fn scanning_mode(&self) -> &ScanningMode

Returns ScanningMode used for the iteration.
Source§

fn ij(&self) -> Result<GridPointIndexIterator, GribError>

Returns an iterator over 2D index (i, j) of grid points.
Source§

impl GridShortName for Template3_10

Source§

fn short_name(&self) -> &'static str

Returns the grid type. Read more
Source§

impl LatLons for Template3_10

Source§

type Iter<'a> = IntoIter<(f32, f32)>

Source§

fn latlons_unchecked<'a>(&'a self) -> Result<Self::Iter<'a>, GribError>

Computes and returns an iterator over latitudes and longitudes of grid points in degrees. Unlike the return values from LatLons::latlons, the longitude values from thie method do not necessarily fall within the range [-180°, 180°].
Source§

fn latlons<'a>( &'a self, ) -> Result<Map<Self::Iter<'a>, fn((f32, f32)) -> (f32, f32)>, GribError>

Computes and returns an iterator over latitudes and longitudes of grid points in degrees. The returned longitude values are converted to fall within the range [-180°, 180°]. Read more
Source§

impl PartialEq for Template3_10

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Template3_10

Source§

impl TryFromSlice for Template3_10

Source§

fn try_from_slice(slice: &[u8], pos: &mut usize) -> TryFromSliceResult<Self>

Performs reading. The pos argument is a variable storing the starting position for reading within the slice. Read more
Source§

impl WriteToBuffer for Template3_10

Source§

fn write_to_buffer(&self, buf: &mut [u8]) -> Result<usize, &'static str>

Performs writing and returns the number of bytes used.
Source§

fn num_bytes_required(&self) -> usize

Returns the number of bytes that are expected to be used for writing.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> DumpField for T
where T: Dump,

§

fn dump_field<'d, W>( &self, name: &str, parent: Option<&Cow<'_, str>>, _doc: Option<&str>, doc_overrides: DocOverrides<'d>, pos: &mut usize, output: &mut W, ) -> Result<(), Error>
where W: Write,

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.

§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.