Struct grib::LatLonGridDefinition
source · pub struct LatLonGridDefinition {
pub ni: u32,
pub nj: u32,
pub first_point_lat: i32,
pub first_point_lon: i32,
pub last_point_lat: i32,
pub last_point_lon: i32,
pub scanning_mode: ScanningMode,
}
Fields§
§ni: u32
§nj: u32
§first_point_lat: i32
§first_point_lon: i32
§last_point_lat: i32
§last_point_lon: i32
§scanning_mode: ScanningMode
Implementations§
source§impl LatLonGridDefinition
impl LatLonGridDefinition
sourcepub fn grid_shape(&self) -> (usize, usize)
pub 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.
Examples
let def = grib::LatLonGridDefinition {
ni: 2,
nj: 3,
first_point_lat: 0,
first_point_lon: 0,
last_point_lat: 2_000_000,
last_point_lon: 1_000_000,
scanning_mode: grib::ScanningMode(0b01000000),
};
let shape = def.grid_shape();
assert_eq!(shape, (2, 3));
sourcepub fn short_name(&self) -> &'static str
pub fn short_name(&self) -> &'static str
Returns the grid type.
sourcepub fn ij(&self) -> Result<GridPointIndexIterator, GribError>
pub fn ij(&self) -> Result<GridPointIndexIterator, GribError>
Returns an iterator over (i, j)
of grid points.
Note that this is a low-level API and it is not checked that the number of iterator iterations is consistent with the number of grid points defined in the data.
Examples
let def = grib::LatLonGridDefinition {
ni: 2,
nj: 3,
first_point_lat: 0,
first_point_lon: 0,
last_point_lat: 2_000_000,
last_point_lon: 1_000_000,
scanning_mode: grib::ScanningMode(0b01000000),
};
let ij = def.ij();
assert!(ij.is_ok());
let mut ij = ij.unwrap();
assert_eq!(ij.next(), Some((0, 0)));
assert_eq!(ij.next(), Some((1, 0)));
assert_eq!(ij.next(), Some((0, 1)));
sourcepub fn latlons(&self) -> Result<RegularGridIterator, GribError>
pub fn latlons(&self) -> Result<RegularGridIterator, GribError>
Returns an iterator over latitudes and longitudes of grid points in degrees.
Note that this is a low-level API and it is not checked that the number of iterator iterations is consistent with the number of grid points defined in the data.
Examples
let def = grib::LatLonGridDefinition {
ni: 2,
nj: 3,
first_point_lat: 0,
first_point_lon: 0,
last_point_lat: 2_000_000,
last_point_lon: 1_000_000,
scanning_mode: grib::ScanningMode(0b01000000),
};
let latlons = def.latlons();
assert!(latlons.is_ok());
let mut latlons = latlons.unwrap();
assert_eq!(latlons.next(), Some((0.0, 0.0)));
assert_eq!(latlons.next(), Some((0.0, 1.0)));
assert_eq!(latlons.next(), Some((1.0, 0.0)));
Trait Implementations§
source§impl Debug for LatLonGridDefinition
impl Debug for LatLonGridDefinition
source§impl PartialEq for LatLonGridDefinition
impl PartialEq for LatLonGridDefinition
source§fn eq(&self, other: &LatLonGridDefinition) -> bool
fn eq(&self, other: &LatLonGridDefinition) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for LatLonGridDefinition
impl StructuralPartialEq for LatLonGridDefinition
Auto Trait Implementations§
impl Freeze for LatLonGridDefinition
impl RefUnwindSafe for LatLonGridDefinition
impl Send for LatLonGridDefinition
impl Sync for LatLonGridDefinition
impl Unpin for LatLonGridDefinition
impl UnwindSafe for LatLonGridDefinition
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more