pub struct RasterData {
pub data: Vec<Vec<f64>>,
pub width: usize,
pub height: usize,
pub nodata: f64,
}Expand description
A 2-D raster grid with an associated no-data sentinel value.
Fields§
§data: Vec<Vec<f64>>Row-major 2-D data grid (data[row][col]).
width: usizeNumber of columns.
height: usizeNumber of rows.
nodata: f64Sentinel value representing missing / invalid cells.
Implementations§
Source§impl RasterData
impl RasterData
Sourcepub fn new(data: Vec<Vec<f64>>, nodata: f64) -> Self
pub fn new(data: Vec<Vec<f64>>, nodata: f64) -> Self
Construct a new RasterData from a 2-D grid.
Sourcepub fn statistics(&self) -> (f64, f64, f64, f64)
pub fn statistics(&self) -> (f64, f64, f64, f64)
Compute (min, max, mean, std_dev) over all valid (non-nodata) cells.
Sourcepub fn clip_to_bbox(&self, bbox: [f64; 4]) -> Self
pub fn clip_to_bbox(&self, bbox: [f64; 4]) -> Self
Clip the raster to a bounding box [min_x, min_y, max_x, max_y].
In pixel space this maps x → col and y → row (0-origin).
Sourcepub fn resample(&self, factor: f64) -> Self
pub fn resample(&self, factor: f64) -> Self
Resample the raster by factor (e.g. 0.5 = half resolution).
Trait Implementations§
Source§impl Clone for RasterData
impl Clone for RasterData
Source§fn clone(&self) -> RasterData
fn clone(&self) -> RasterData
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RasterData
impl RefUnwindSafe for RasterData
impl Send for RasterData
impl Sync for RasterData
impl Unpin for RasterData
impl UnsafeUnpin for RasterData
impl UnwindSafe for RasterData
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.