pub struct NetCDFReader<T: Reader> {
pub record_dimension: CDFRecordDimension,
pub dimensions: Vec<CDFDimension>,
pub global_attributes: CDFAttributes,
pub variables: Vec<CDFVariable>,
pub is64: bool,
/* private fields */
}Expand description
§NetCDF v3.x Reader
§Description
Read the NetCDF v3.x file format
Implements the FeatureReader trait
§Usage
The methods you have access to:
NetCDFReader::new: Create a new NetCDFReaderNetCDFReader::len: Returns the number of recordsNetCDFReader::is_empty: Returns true if the reader is emptyNetCDFReader::get_properties: Returns the properties for a given indexNetCDFReader::get_point: Get the point at a given indexNetCDFReader::get_feature: Reads a point in at index as a featureNetCDFReader::get_data_variable: Retrieves the data for a given variableNetCDFReader::iter: Create an iterator over the featuresNetCDFReader::par_iter: Create a parallel iterator over the features
§Buffer Reader
use gistools::{
parsers::{FeatureReader, BufferReader},
readers::{NetCDFReader, NetCDFReaderOptions},
};
// Ignore this, used to setup example
use std::path::PathBuf;
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.push("tests/readers/netcdf/fixtures/ichthyop.nc");
let data: Vec<u8> = std::fs::read(path).unwrap();
let netcdf_reader = NetCDFReader::new(
BufferReader::from(data),
Some(NetCDFReaderOptions {
lon_key: Some("lon".into()),
lat_key: Some("lat".into()),
height_key: Some("depth".into()),
prop_fields: Some(vec!["depth".into()]),
}),
);
assert_eq!(netcdf_reader.len(), 49);
let features: Vec<_> = netcdf_reader.iter().collect();§Links
Fields§
§record_dimension: CDFRecordDimensionRecord dimension
dimensions: Vec<CDFDimension>List of dimensions
global_attributes: CDFAttributesList of global attributes
variables: Vec<CDFVariable>List of variables
is64: boolDescribes if offsets are 32 or 64 bits
Implementations§
Source§impl<T: Reader> NetCDFReader<T>
impl<T: Reader> NetCDFReader<T>
Sourcepub fn new(reader: T, options: Option<NetCDFReaderOptions>) -> Self
pub fn new(reader: T, options: Option<NetCDFReaderOptions>) -> Self
Creates a new NetCDF reader
Sourcepub fn get_properties(&self, index: u64) -> Option<MValue>
pub fn get_properties(&self, index: u64) -> Option<MValue>
Get the properties at a given index
Sourcepub fn get_point(&self, index: u64) -> Option<VectorPoint<MValue>>
pub fn get_point(&self, index: u64) -> Option<VectorPoint<MValue>>
Get the point at a given index
Sourcepub fn get_feature(&self, index: u64) -> Option<CDFVectorFeature>
pub fn get_feature(&self, index: u64) -> Option<CDFVectorFeature>
Reads a point in at index as a feature
Trait Implementations§
Source§impl<T: Clone + Reader> Clone for NetCDFReader<T>
impl<T: Clone + Reader> Clone for NetCDFReader<T>
Source§fn clone(&self) -> NetCDFReader<T>
fn clone(&self) -> NetCDFReader<T>
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Reader> FeatureReader<(), Map<String, ValueType>, Map<String, ValueType>> for NetCDFReader<T>
A feature reader trait with a callback-based approach
impl<T: Reader> FeatureReader<(), Map<String, ValueType>, Map<String, ValueType>> for NetCDFReader<T>
A feature reader trait with a callback-based approach
Source§type FeatureIterator<'a> = CDFIterator<'a, T>
where
T: 'a
type FeatureIterator<'a> = CDFIterator<'a, T> where T: 'a
The Feature Reader should implement an iterator of some kind
Source§fn iter(&self) -> Self::FeatureIterator<'_>
fn iter(&self) -> Self::FeatureIterator<'_>
All readers have an iter function that returns a Iterator struct
Auto Trait Implementations§
impl<T> !Freeze for NetCDFReader<T>
impl<T> !RefUnwindSafe for NetCDFReader<T>
impl<T> Send for NetCDFReader<T>where
T: Send,
impl<T> !Sync for NetCDFReader<T>
impl<T> Unpin for NetCDFReader<T>where
T: Unpin,
impl<T> UnwindSafe for NetCDFReader<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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