pub struct ClassicFile { /* private fields */ }Expand description
An opened classic-format NetCDF file (CDF-1, CDF-2, or CDF-5).
Implementations§
Source§impl ClassicFile
impl ClassicFile
Sourcepub fn read_variable<T: NcReadType>(&self, name: &str) -> Result<ArrayD<T>>
pub fn read_variable<T: NcReadType>(&self, name: &str) -> Result<ArrayD<T>>
Read a variable’s data as an ndarray of the specified type.
The type parameter T must match the variable’s NetCDF type. For example,
use f32 for NC_FLOAT variables and f64 for NC_DOUBLE variables.
Sourcepub fn read_variable_as_f64(&self, name: &str) -> Result<ArrayD<f64>>
pub fn read_variable_as_f64(&self, name: &str) -> Result<ArrayD<f64>>
Read a variable’s data with automatic type promotion to f64.
This reads any numeric variable and converts all values to f64, which is convenient for analysis but may lose precision for i64/u64.
Sourcepub fn read_variable_as_string(&self, name: &str) -> Result<String>
pub fn read_variable_as_string(&self, name: &str) -> Result<String>
Read a char variable as a String (or Vec
Sourcepub fn read_variable_as_strings(&self, name: &str) -> Result<Vec<String>>
pub fn read_variable_as_strings(&self, name: &str) -> Result<Vec<String>>
Read a char variable as a flat vector of strings.
For 2-D and higher char arrays, the last dimension is interpreted as the string length and the leading dimensions are flattened.
Sourcepub fn read_variable_slice<T: NcReadType>(
&self,
name: &str,
selection: &NcSliceInfo,
) -> Result<ArrayD<T>>
pub fn read_variable_slice<T: NcReadType>( &self, name: &str, selection: &NcSliceInfo, ) -> Result<ArrayD<T>>
Read a slice (hyperslab) of a variable.
Classic variables are read directly from the on-disk byte ranges for arbitrary selections.
Sourcepub fn read_variable_slice_as_f64(
&self,
name: &str,
selection: &NcSliceInfo,
) -> Result<ArrayD<f64>>
pub fn read_variable_slice_as_f64( &self, name: &str, selection: &NcSliceInfo, ) -> Result<ArrayD<f64>>
Read a slice with automatic type promotion to f64.
Source§impl ClassicFile
impl ClassicFile
Sourcepub fn open(path: &Path, format: NcFormat) -> Result<Self>
pub fn open(path: &Path, format: NcFormat) -> Result<Self>
Open a classic NetCDF file from disk using memory-mapping.
Sourcepub fn from_bytes(bytes: &[u8], format: NcFormat) -> Result<Self>
pub fn from_bytes(bytes: &[u8], format: NcFormat) -> Result<Self>
Open a classic NetCDF file from in-memory bytes.
Sourcepub fn from_mmap(mmap: Mmap, format: NcFormat) -> Result<Self>
pub fn from_mmap(mmap: Mmap, format: NcFormat) -> Result<Self>
Open a classic NetCDF file from an existing memory map (avoids double mmap).
Sourcepub fn root_group(&self) -> &NcGroup
pub fn root_group(&self) -> &NcGroup
The root group containing all dimensions, variables, and global attributes.
Auto Trait Implementations§
impl Freeze for ClassicFile
impl RefUnwindSafe for ClassicFile
impl Send for ClassicFile
impl Sync for ClassicFile
impl Unpin for ClassicFile
impl UnsafeUnpin for ClassicFile
impl UnwindSafe for ClassicFile
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> 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 more