pub struct LabeledArray<T> { /* private fields */ }Expand description
A high-level, labeled multi-dimensional array structure for geospatial data.
Implementations§
Source§impl<T> LabeledArray<T>where
T: Clone,
impl<T> LabeledArray<T>where
T: Clone,
pub fn new(data: ArrayD<T>, dims: Vec<String>) -> Self
pub fn new_with_coords( data: ArrayD<T>, dims: Vec<String>, coords: HashMap<String, CoordinateVec>, ) -> Self
pub fn dims(&self) -> &[String]
pub fn shape(&self) -> &[usize]
pub fn ndim(&self) -> usize
pub fn data(&self) -> &ArrayD<T>
pub fn data_mut(&mut self) -> &mut ArrayD<T>
pub fn coords<C: Coordinate>(&self, dim: &str) -> Option<&[C]>
pub fn all_coords(&self) -> &HashMap<String, CoordinateVec>
pub fn set_coords<C: Coordinate>( &mut self, dim: &str, coords: Vec<C>, ) -> Result<(), LabeledError>
pub fn dim_index(&self, dim: &str) -> Option<usize>
pub fn select_by_label<C: Coordinate>( &self, dim: &str, label: &C, ) -> Option<usize>
Sourcepub fn sel(&self, selectors: HashMap<&str, Selector>) -> Self
pub fn sel(&self, selectors: HashMap<&str, Selector>) -> Self
Select a subset of the array using dimension and coordinate labels.
§Arguments
selectors- A HashMap where keys are dimension names and values areSelectorenums (Selector::LabelorSelector::Slice).
§Returns
A new LabeledArray containing the sliced data.
§Panics
Panics if a specified dimension does not exist or if a label is not found.
Trait Implementations§
Source§impl<T: Clone> Clone for LabeledArray<T>
impl<T: Clone> Clone for LabeledArray<T>
Source§fn clone(&self) -> LabeledArray<T>
fn clone(&self) -> LabeledArray<T>
Returns a duplicate of the value. Read more
1.0.0 · 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<T> Freeze for LabeledArray<T>
impl<T> !RefUnwindSafe for LabeledArray<T>
impl<T> !Send for LabeledArray<T>
impl<T> !Sync for LabeledArray<T>
impl<T> Unpin for LabeledArray<T>
impl<T> !UnwindSafe for LabeledArray<T>
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<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>
Converts
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>
Converts
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