#[non_exhaustive]pub enum GridDefinition {
LatLon(LatLonGrid),
RotatedLatLon(RotatedLatLonGrid),
Mercator(MercatorGrid),
AlbersEqualArea(AlbersEqualAreaGrid),
LambertConformal(LambertConformalGrid),
PolarStereographic(PolarStereographicGrid),
RegularGaussian(RegularGaussianGrid),
Unsupported(u16),
}Expand description
Grid definition extracted from Section 3.
This enum is non-exhaustive because GRIB grid templates are open-ended: WMO can add standard templates and centers can use local templates. Prefer the query helpers on this type for common behavior, or keep a wildcard arm when matching specific grid families.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
LatLon(LatLonGrid)
Template 3.0: Regular latitude/longitude (equidistant cylindrical).
RotatedLatLon(RotatedLatLonGrid)
Template 3.1: Rotated latitude/longitude.
Mercator(MercatorGrid)
Template 3.10: Mercator.
AlbersEqualArea(AlbersEqualAreaGrid)
Template 3.31: Albers equal-area.
LambertConformal(LambertConformalGrid)
Template 3.30: Lambert conformal.
PolarStereographic(PolarStereographicGrid)
Template 3.20: Polar stereographic projection.
RegularGaussian(RegularGaussianGrid)
Template 3.40: Regular Gaussian latitude/longitude.
Unsupported(u16)
Unsupported template (stored for diagnostics).
Implementations§
Source§impl GridDefinition
impl GridDefinition
Sourcepub fn template_number(&self) -> u16
pub fn template_number(&self) -> u16
GRIB2 grid definition template number for typed templates.
Unsupported stores the unhandled template number from the source
message for diagnostics.
pub fn as_lat_lon(&self) -> Option<&LatLonGrid>
pub fn as_rotated_lat_lon(&self) -> Option<&RotatedLatLonGrid>
pub fn as_regular_gaussian(&self) -> Option<&RegularGaussianGrid>
pub fn as_polar_stereographic(&self) -> Option<&PolarStereographicGrid>
pub fn as_mercator(&self) -> Option<&MercatorGrid>
pub fn as_lambert_conformal(&self) -> Option<&LambertConformalGrid>
pub fn as_albers_equal_area(&self) -> Option<&AlbersEqualAreaGrid>
pub fn projected_core(&self) -> Option<&ProjectedGridCore>
pub fn unsupported_template(&self) -> Option<u16>
pub fn shape(&self) -> (usize, usize)
Sourcepub fn scanning_mode(&self) -> Option<u8>
pub fn scanning_mode(&self) -> Option<u8>
Returns the grid’s Code Table 3.4 scanning-mode byte.
Sourcepub fn scan_line_shape(&self) -> Result<(usize, usize), Error>
pub fn scan_line_shape(&self) -> Result<(usize, usize), Error>
Returns (points_per_scan_line, number_of_scan_lines).
This is the grouping geometry used by GRIB1 row-by-row second-order packing and GRIB2 complex-packing group splitting method 0.
pub fn shape_num_points(&self) -> Result<usize, Error>
pub fn ndarray_shape(&self) -> Vec<usize>
pub fn num_points(&self) -> usize
pub fn checked_num_points(&self) -> Result<usize, Error>
pub fn declared_num_points(&self) -> Option<usize>
Sourcepub fn latitudes(&self) -> Result<Option<Vec<f64>>, Error>
pub fn latitudes(&self) -> Result<Option<Vec<f64>>, Error>
One-dimensional latitude axis for unrotated geographic grids.
pub fn latitudes_with_limit( &self, max_axis_points: Option<usize>, ) -> Result<Option<Vec<f64>>, Error>
Sourcepub fn longitudes(&self) -> Result<Option<Vec<f64>>, Error>
pub fn longitudes(&self) -> Result<Option<Vec<f64>>, Error>
One-dimensional longitude axis for unrotated geographic grids.
pub fn longitudes_with_limit( &self, max_axis_points: Option<usize>, ) -> Result<Option<Vec<f64>>, Error>
Sourcepub fn projected_x_coordinates(&self) -> Result<Option<Vec<f64>>, Error>
pub fn projected_x_coordinates(&self) -> Result<Option<Vec<f64>>, Error>
Projected x coordinates in metres relative to the first grid point.
Regular latitude/longitude grids return None; use
LatLonGrid::longitudes for those grids.
pub fn projected_x_coordinates_with_limit( &self, max_axis_points: Option<usize>, ) -> Result<Option<Vec<f64>>, Error>
Sourcepub fn projected_y_coordinates(&self) -> Result<Option<Vec<f64>>, Error>
pub fn projected_y_coordinates(&self) -> Result<Option<Vec<f64>>, Error>
Projected y coordinates in metres relative to the first grid point.
Regular latitude/longitude grids return None; use
LatLonGrid::latitudes for those grids.
pub fn projected_y_coordinates_with_limit( &self, max_axis_points: Option<usize>, ) -> Result<Option<Vec<f64>>, Error>
pub fn validate_supported_scan_order(&self) -> Result<(), Error>
Sourcepub fn reorder_for_ndarray_in_place<T>(
&self,
values: &mut [T],
) -> Result<(), Error>
pub fn reorder_for_ndarray_in_place<T>( &self, values: &mut [T], ) -> Result<(), Error>
Converts GRIB scan traversal into row-major order by undoing alternating row scans. The encoded i/j direction is deliberately preserved.
Sourcepub fn normalize_north_up_in_place<T>(
&self,
values: &mut [T],
) -> Result<(), Error>
pub fn normalize_north_up_in_place<T>( &self, values: &mut [T], ) -> Result<(), Error>
Converts GRIB scan traversal to deterministic row-major orientation: columns increase in +i order and rows increase in -j order (north to south for conventional geographic grids).
pub fn parse(section_bytes: &[u8]) -> Result<GridDefinition, Error>
Trait Implementations§
Source§impl Clone for GridDefinition
impl Clone for GridDefinition
Source§fn clone(&self) -> GridDefinition
fn clone(&self) -> GridDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GridDefinition
impl Debug for GridDefinition
Source§impl PartialEq for GridDefinition
impl PartialEq for GridDefinition
impl StructuralPartialEq for GridDefinition
Auto Trait Implementations§
impl Freeze for GridDefinition
impl RefUnwindSafe for GridDefinition
impl Send for GridDefinition
impl Sync for GridDefinition
impl Unpin for GridDefinition
impl UnsafeUnpin for GridDefinition
impl UnwindSafe for GridDefinition
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 more