pub struct MDArray<'a> { /* private fields */ }Expand description
Represent an MDArray in a Group
This object carries the lifetime of the Group that contains it. This is necessary to prevent the Group from being dropped before the mdarray.
Implementations§
Source§impl<'a> MDArray<'a>
impl<'a> MDArray<'a>
Sourcepub unsafe fn from_c_mdarray_and_group(
_group: &'a Group<'_>,
c_mdarray: GDALMDArrayH,
) -> Self
pub unsafe fn from_c_mdarray_and_group( _group: &'a Group<'_>, c_mdarray: GDALMDArrayH, ) -> Self
Sourcepub unsafe fn from_c_mdarray_and_dimension(
_dimension: &'a Dimension<'_>,
c_mdarray: GDALMDArrayH,
) -> Self
pub unsafe fn from_c_mdarray_and_dimension( _dimension: &'a Dimension<'_>, c_mdarray: GDALMDArrayH, ) -> Self
pub fn num_dimensions(&self) -> usize
pub fn num_elements(&self) -> u64
pub fn dimensions(&self) -> Result<Vec<Dimension<'_>>>
pub fn datatype(&self) -> ExtendedDataType
Sourcepub fn read_into_slice<T: Copy + GdalType>(
&self,
buffer: &mut [T],
array_start_index: Vec<u64>,
count: Vec<usize>,
) -> Result<()>
pub fn read_into_slice<T: Copy + GdalType>( &self, buffer: &mut [T], array_start_index: Vec<u64>, count: Vec<usize>, ) -> Result<()>
Wrapper for GDALMDArrayRead
§Params
- buffer - Mutable buffer to read into
- array_start_index - Values representing the starting index to read in each dimension (in
[0, aoDims[i].GetSize()-1]range). Array ofGetDimensionCount()values. Must not be empty, unless for a zero-dimensional array. - count - Values representing the number of values to extract in each dimension. Array of
GetDimensionCount()values. Must not be empty, unless for a zero-dimensional array.
Sourcepub fn read_as<T: Copy + GdalType>(
&self,
array_start_index: Vec<u64>,
count: Vec<usize>,
) -> Result<Vec<T>>
pub fn read_as<T: Copy + GdalType>( &self, array_start_index: Vec<u64>, count: Vec<usize>, ) -> Result<Vec<T>>
Read a Vec<T> from this band, where T implements GdalType.
§Arguments
array_start_index- Values representing the starting index to read in each dimension (in[0, aoDims[i].GetSize()-1]range). Array ofGetDimensionCount()values. Must not be empty, unless for a zero-dimensional array.count- Values representing the number of values to extract in each dimension. Array ofGetDimensionCount()values. Must not be empty, unless for a zero-dimensional array.
Sourcepub fn read_as_array<T: Copy + GdalType + Debug>(
&self,
array_start_index: Vec<u64>,
count: Vec<usize>,
array_size: Vec<usize>,
) -> Result<ArrayD<T>>
Available on crate feature ndarray only.
pub fn read_as_array<T: Copy + GdalType + Debug>( &self, array_start_index: Vec<u64>, count: Vec<usize>, array_size: Vec<usize>, ) -> Result<ArrayD<T>>
ndarray only.Read an ArrayD<T> from this band. T implements GdalType.
§Arguments
window- the window position from top leftwindow_size- the window size (GDAL will interpolate data if window_size != array_size)array_size- the desired size of the ‘Array’e_resample_alg- the resample algorithm used for the interpolation
§Notes
The Matrix shape is (rows, cols) and raster shape is (cols in x-axis, rows in y-axis).
Sourcepub fn read_as_string_array(&self) -> Result<Vec<String>>
pub fn read_as_string_array(&self) -> Result<Vec<String>>
Read MDArray as one-dimensional string array
pub fn spatial_reference(&self) -> Result<SpatialRef>
pub fn no_data_value_as_double(&self) -> Option<f64>
pub fn unit(&self) -> String
pub fn attribute(&self, name: &str) -> Result<Attribute>
Sourcepub fn get_statistics(
&self,
force: bool,
is_approx_ok: bool,
) -> Result<Option<MdStatisticsAll>>
pub fn get_statistics( &self, force: bool, is_approx_ok: bool, ) -> Result<Option<MdStatisticsAll>>
Fetch statistics.
Returns the minimum, maximum, mean and standard deviation of all pixel values in this array.
If force is false results will only be returned if it can be done quickly (i.e. without scanning the data).
If force is false and results cannot be returned efficiently, the method will return None.
When cached statistics are not available, and force is true, ComputeStatistics() is called.
Note that file formats using PAM (Persistent Auxiliary Metadata) services will generally cache statistics in the .aux.xml file allowing fast fetch after the first request.
This methods is a wrapper for GDALMDArrayGetStatistics.
TODO: add option to pass progress callback (pfnProgress)