#[non_exhaustive]pub struct Grid {
pub ni: u32,
pub nj: u32,
pub earth: Earth,
pub south_to_north: bool,
pub winds_grid_relative: bool,
pub projection: Projection,
}Expand description
A field’s grid: its size, its projection and how its points are ordered.
Points are numbered i + ni · j, i along a row (east on a latitude/longitude grid, +x on a
Lambert grid) and j from row to row. Rows run south to north when
Grid::south_to_north, else north to south; the reader refuses other scanning modes.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ni: u32Points along a row.
nj: u32Rows.
earth: EarthThe figure of the Earth.
south_to_north: boolWhether rows run south to north (+j, scanning mode bit 2); otherwise north to south.
winds_grid_relative: boolWhether vector components (winds) are along the grid’s x and y axes rather than east
and north (flag table 3.3, bit 5).
projection: ProjectionThe projection.
Implementations§
Source§impl Grid
impl Grid
Sourcepub fn point_deg(&self, index: u64) -> Option<(f64, f64)>
pub fn point_deg(&self, index: u64) -> Option<(f64, f64)>
Grid point index’s latitude (degrees north) and longitude (degrees east, in [0, 360)),
or None outside the grid.
Sourcepub fn circles_the_earth(&self) -> bool
pub fn circles_the_earth(&self) -> bool
Whether a latitude/longitude grid’s rows go all the way round the Earth: ni steps of
di make 360°, so the point after the last in a row is the row’s first. A step is written
in millionths of a degree, so a 1/12° grid’s 4,320 steps of 0.083333° make 359.9986°: the
test allows a millionth of a degree a step, for an encoder that truncates.
Sourcepub fn index_at(&self, latitude_deg: f64, longitude_deg: f64) -> (f64, f64)
pub fn index_at(&self, latitude_deg: f64, longitude_deg: f64) -> (f64, f64)
The fractional grid indices (i, j) of a place, such that grid point (⌊i⌋, ⌊j⌋) and its
neighbours at +1 surround it; the place may be outside the grid.
Sourcepub fn north_to_grid_y_rad(&self, longitude_deg: f64) -> f64
pub fn north_to_grid_y_rad(&self, longitude_deg: f64) -> f64
The angle from true north to the grid’s +y axis at a place, clockwise positive, rad:
θ = n (λ − λ₀) on a Lambert grid (Snyder eq. 14-4), 0 on a latitude/longitude grid,
whose axes point east and north. West of the central meridian θ < 0: the meridians lean
toward the cone’s apex, so north is turned toward +x and the grid’s +y west of north.
Sourcepub fn earth_relative_wind(
&self,
u_m_s: f64,
v_m_s: f64,
longitude_deg: f64,
) -> (f64, f64)
pub fn earth_relative_wind( &self, u_m_s: f64, v_m_s: f64, longitude_deg: f64, ) -> (f64, f64)
A wind’s east and north components, m/s, from its components as the field gives them:
unchanged unless Grid::winds_grid_relative, else turned from the grid’s axes.
On a Lambert grid true north is (−sin θ, cos θ) in grid axes and east (cos θ, sin θ),
with θ = n (λ − λ₀), so u_east = u cos θ + v sin θ and v_north = −u sin θ + v cos θ.