pub struct NetCdfDataset {
pub dimensions: Vec<NetCdfDimension>,
pub global_attributes: Vec<NetCdfAttribute>,
pub variables: Vec<NetCdfVariable>,
}Expand description
A complete NetCDF3 dataset loaded into memory.
Fields§
§dimensions: Vec<NetCdfDimension>Ordered list of dimensions
global_attributes: Vec<NetCdfAttribute>Global attributes
variables: Vec<NetCdfVariable>Variables (including coordinate variables)
Implementations§
Source§impl NetCdfDataset
impl NetCdfDataset
Sourcepub fn from_file(path: impl AsRef<Path>) -> Result<Self>
pub fn from_file(path: impl AsRef<Path>) -> Result<Self>
Read a NetCDF3 file from disk.
§Errors
Returns DatasetsError if the file cannot be opened, is not a valid
NetCDF3 file, or a variable’s data cannot be read.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Parse a NetCDF3 dataset from an in-memory byte slice.
The bytes must start with the NetCDF3 magic (CDF\x01 or CDF\x02).
Internally the bytes are written to a temporary file and read back via
the netcdf3 crate, which requires a seekable Read backed by a real
file.
§Errors
Returns DatasetsError::InvalidFormat if the bytes are not valid
NetCDF3 or if reading fails.
Sourcepub fn variable(&self, name: &str) -> Option<&NetCdfVariable>
pub fn variable(&self, name: &str) -> Option<&NetCdfVariable>
Look up a variable by name.
Sourcepub fn dimension(&self, name: &str) -> Option<&NetCdfDimension>
pub fn dimension(&self, name: &str) -> Option<&NetCdfDimension>
Look up a dimension by name.
Sourcepub fn variable_names(&self) -> Vec<&str>
pub fn variable_names(&self) -> Vec<&str>
Return all variable names.
Sourcepub fn dimension_names(&self) -> Vec<&str>
pub fn dimension_names(&self) -> Vec<&str>
Return all dimension names.
Sourcepub fn to_float_array(&self, var_name: &str) -> Result<Array1<f32>>
pub fn to_float_array(&self, var_name: &str) -> Result<Array1<f32>>
Get a float (f32) array for the named variable.
§Errors
Returns NotFound if no variable with that name exists, or
InvalidFormat if the variable’s data is not a Float32 type.
Trait Implementations§
Source§impl Clone for NetCdfDataset
impl Clone for NetCdfDataset
Source§fn clone(&self) -> NetCdfDataset
fn clone(&self) -> NetCdfDataset
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for NetCdfDataset
impl RefUnwindSafe for NetCdfDataset
impl Send for NetCdfDataset
impl Sync for NetCdfDataset
impl Unpin for NetCdfDataset
impl UnsafeUnpin for NetCdfDataset
impl UnwindSafe for NetCdfDataset
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.