pub struct Template3_1 {
pub earth: EarthShape,
pub rotated: LatLonGrid,
pub rotation: Rotation,
}Expand description
Grid definition template 3.1 - rotated latitude/longitude (or equidistant cylindrical, or Plate Carrée).
§Examples
use std::io::Read;
use grib::def::grib2::template::{Template3_1, param_set};
use grib_template_helpers::TryFromSlice;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut buf = Vec::new();
let f = std::fs::File::open(
"testdata/20260219T00Z_MSC_HRDPS_CAPE_Sfc_RLatLon0.0225_PT000H.grib2",
)?;
let mut f = std::io::BufReader::new(f);
f.read_to_end(&mut buf)?;
let mut pos = 0x33;
let actual = Template3_1::try_from_slice(&buf, &mut pos)?;
let expected = Template3_1 {
earth: param_set::EarthShape {
shape: 6,
spherical_earth_radius_scale_factor: 0xff,
spherical_earth_radius_scaled_value: 0xffffffff,
major_axis_scale_factor: 0xff,
major_axis_scaled_value: 0xffffffff,
minor_axis_scale_factor: 0xff,
minor_axis_scaled_value: 0xffffffff,
},
rotated: param_set::LatLonGrid {
grid: param_set::Grid {
ni: 2540,
nj: 1290,
initial_production_domain_basic_angle: 0,
basic_angle_subdivisions: 0xffffffff,
first_point_lat: -12302501,
first_point_lon: 345178780,
resolution_and_component_flags: param_set::ResolutionAndComponentFlags(
0b00111000,
),
last_point_lat: 16700001,
last_point_lon: 42306283,
},
scanning_mode: param_set::ScanningMode(0b01000000),
i_direction_inc: 22500,
j_direction_inc: 22500,
},
rotation: param_set::Rotation {
south_pole_lat: -36088520,
south_pole_lon: 245305142,
rot_angle: 0.,
},
};
assert_eq!(actual, expected);
Ok(())
}Fields§
§earth: EarthShape§rotated: LatLonGrid§rotation: RotationTrait Implementations§
Source§impl Debug for Template3_1
impl Debug for Template3_1
Source§impl Dump for Template3_1
impl Dump for Template3_1
Source§impl GridPointIndex for Template3_1
impl GridPointIndex for Template3_1
Source§fn grid_shape(&self) -> (usize, usize)
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.
Source§fn scanning_mode(&self) -> &ScanningMode
fn scanning_mode(&self) -> &ScanningMode
Returns
ScanningMode used for the iteration.Source§impl GridShortName for Template3_1
impl GridShortName for Template3_1
Source§fn short_name(&self) -> &'static str
fn short_name(&self) -> &'static str
Returns the grid type. Read more
Source§impl LatLons for Template3_1
impl LatLons for Template3_1
Source§impl PartialEq for Template3_1
impl PartialEq for Template3_1
Source§impl TryFromSlice for Template3_1
impl TryFromSlice for Template3_1
impl StructuralPartialEq for Template3_1
Auto Trait Implementations§
impl Freeze for Template3_1
impl RefUnwindSafe for Template3_1
impl Send for Template3_1
impl Sync for Template3_1
impl Unpin for Template3_1
impl UnsafeUnpin for Template3_1
impl UnwindSafe for Template3_1
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