pub struct GeoidGrid { /* private fields */ }Expand description
A regular latitude/longitude grid of geoid undulation samples (metres) with bilinear interpolation.
Samples are stored row-major with latitude ascending (outer) and longitude
ascending (inner): values_m[i * n_lon + j] is the undulation at latitude
lat_min_deg + i * dlat_deg and longitude lon_min_deg + j * dlon_deg.
Latitude inputs are clamped to the grid’s latitude span. Longitude inputs are
normalized to [-180, 180) and then, when the grid spans a full 360 degrees
of longitude, wrapped across the antimeridian; otherwise they are clamped to
the grid’s longitude span (so a regional grid does not wrap).
Implementations§
Source§impl GeoidGrid
impl GeoidGrid
Sourcepub fn new(
lat_min_deg: f64,
lon_min_deg: f64,
dlat_deg: f64,
dlon_deg: f64,
n_lat: usize,
n_lon: usize,
values_m: Vec<f64>,
) -> Result<Self, GeoidError>
pub fn new( lat_min_deg: f64, lon_min_deg: f64, dlat_deg: f64, dlon_deg: f64, n_lat: usize, n_lon: usize, values_m: Vec<f64>, ) -> Result<Self, GeoidError>
Build a geoid grid from its origin, spacing, dimensions, and row-major samples (metres).
Returns GeoidError when a dimension is zero, the sample count does not
equal n_lat * n_lon, a spacing/origin is non-finite or a spacing is
non-positive, or a sample is non-finite.
Sourcepub fn from_text(text: &str) -> Result<Self, GeoidError>
pub fn from_text(text: &str) -> Result<Self, GeoidError>
Parse a geoid grid from a simple, documented text format (the data-loading hook for full EGM grids).
The format is whitespace-delimited with # line comments. The first
non-comment token sequence is a six-field header:
lat_min lon_min dlat dlon n_lat n_lonfollowed by exactly n_lat * n_lon undulation samples in metres, in
row-major order (latitude ascending outer, longitude ascending inner).
All angles are in degrees. This is deliberately a minimal, line-oriented
format; a caller converting a vendor grid (EGM .gri/.ndp, a GeoTIFF,
etc.) lowers it to this shape or builds a GeoidGrid via new.
Sourcepub fn undulation_rad(&self, lat_rad: f64, lon_rad: f64) -> f64
pub fn undulation_rad(&self, lat_rad: f64, lon_rad: f64) -> f64
Bilinearly interpolated undulation N (metres) at a geodetic position in
radians (latitude positive north, longitude positive east).
Sourcepub fn undulation_deg(&self, lat_deg: f64, lon_deg: f64) -> f64
pub fn undulation_deg(&self, lat_deg: f64, lon_deg: f64) -> f64
Bilinearly interpolated undulation N (metres) at a geodetic position in
degrees (latitude positive north, longitude positive east).
Trait Implementations§
impl StructuralPartialEq for GeoidGrid
Auto Trait Implementations§
impl Freeze for GeoidGrid
impl RefUnwindSafe for GeoidGrid
impl Send for GeoidGrid
impl Sync for GeoidGrid
impl Unpin for GeoidGrid
impl UnsafeUnpin for GeoidGrid
impl UnwindSafe for GeoidGrid
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.