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 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<LatLonGridIterator, GribError>
pub fn latlons(&self) -> Result<LatLonGridIterator, GribError>
Returns an iterator over latitudes and longitudes 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 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 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