pub struct NetcdfWriter { /* private fields */ }Expand description
A builder-style writer for the simplified NetCDF-like text (CDL) format.
Supports dimension management, coordinate variables, typed variables, global attributes, and trajectory serialisation.
Implementations§
Source§impl NetcdfWriter
impl NetcdfWriter
Sourcepub fn add_dimension(&mut self, name: &str, size: usize) -> &mut Self
pub fn add_dimension(&mut self, name: &str, size: usize) -> &mut Self
Add a fixed-size dimension.
Sourcepub fn add_unlimited_dimension(
&mut self,
name: &str,
current_size: usize,
) -> &mut Self
pub fn add_unlimited_dimension( &mut self, name: &str, current_size: usize, ) -> &mut Self
Add an unlimited (record) dimension.
Sourcepub fn add_global_attribute(&mut self, key: &str, value: &str) -> &mut Self
pub fn add_global_attribute(&mut self, key: &str, value: &str) -> &mut Self
Add a global attribute.
Sourcepub fn add_variable(
&mut self,
name: &str,
dims: &[&str],
data: Vec<f64>,
) -> &mut Self
pub fn add_variable( &mut self, name: &str, dims: &[&str], data: Vec<f64>, ) -> &mut Self
Add a variable with given dimension names and flat data.
Sourcepub fn add_variable_attribute(&mut self, key: &str, value: &str) -> &mut Self
pub fn add_variable_attribute(&mut self, key: &str, value: &str) -> &mut Self
Add an attribute to the most recently added variable.
Sourcepub fn add_coordinate(
&mut self,
dim_name: &str,
data: Vec<f64>,
units: &str,
) -> &mut Self
pub fn add_coordinate( &mut self, dim_name: &str, data: Vec<f64>, units: &str, ) -> &mut Self
Add a coordinate variable (1D variable with the same name as its dimension).
Sourcepub fn n_dimensions(&self) -> usize
pub fn n_dimensions(&self) -> usize
Number of dimensions.
Sourcepub fn n_variables(&self) -> usize
pub fn n_variables(&self) -> usize
Number of variables.
Sourcepub fn write_to_file(&self, path: &str) -> Result<()>
pub fn write_to_file(&self, path: &str) -> Result<()>
Write the CDL to a file.
Trait Implementations§
Source§impl Clone for NetcdfWriter
impl Clone for NetcdfWriter
Source§fn clone(&self) -> NetcdfWriter
fn clone(&self) -> NetcdfWriter
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 Freeze for NetcdfWriter
impl RefUnwindSafe for NetcdfWriter
impl Send for NetcdfWriter
impl Sync for NetcdfWriter
impl Unpin for NetcdfWriter
impl UnsafeUnpin for NetcdfWriter
impl UnwindSafe for NetcdfWriter
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<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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.