Skip to main content

LatLonGrid

Struct LatLonGrid 

Source
pub struct LatLonGrid {
    pub shape: (usize, usize),
    pub first_point: (f64, f64),
    pub last_point: (f64, f64),
    pub i_consecutive: bool,
}
Expand description

An auxiliary struct for creating the definition of a latitude/longitude grid (def::grib2::template::param_set::LatLonGrid) in a more intuitive way.

You can specify any value within the range of -360 degrees to 360 degrees for the longitude values of the first and last points. However, to distinguish the grid area, set the longitude value at the western end of the grid to a value smaller than that at the eastern end.

For example:

  • For a grid extending eastward from 0° to 5°W, specify the first point’s longitude as 0.0 and the last point’s longitude as 355.0.
  • For a grid extending westward from 0° to 5°W, specify the first point’s longitude as 0.0 and the last point’s longitude as -5.0.
  • For a grid extending eastward from 180° to 175°W, specify the first point’s longitude as -180.0 and the last point’s longitude as 175.0.
  • For a grid extending westward from 180° to 175°W, specify the first point’s longitude as 180.0 and the last point’s longitude as 175.0.

Longitude values are automatically normalized during conversion to def::grib2::template::param_set::LatLonGrid to comply with GRIB2 specification.

Fields§

§shape: (usize, usize)

Shape of the grid, in the form (ni, nj).

§first_point: (f64, f64)

First coordinate point, in the form (lat, lon). The order in which you specify the “first” point should correspond to the order of the array of grid point values.

§last_point: (f64, f64)

The coordinate point diagonally opposite the first coordinate point, in the form (lat, lon).

§i_consecutive: bool

Whether the grid point values consecutive in the i-direction (longitude direction) or not.

Implementations§

Source§

impl LatLonGrid

Source

pub fn num_points(&self) -> usize

Returns the number of points of the grid.

Source

pub fn scanning_mode(&self) -> ScanningMode

Returns the scanning mode of the grid.

Trait Implementations§

Source§

impl From<&LatLonGrid> for LatLonGrid

Source§

fn from(value: &LatLonGrid) -> Self

Converts to this type from the input type.

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.

§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

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.