pub struct Variable {
pub name: String,
pub dimensions: Vec<Arc<str>>,
pub shape: Vec<u64>,
pub attributes: Vec<Attribute>,
pub values: Values,
}Expand description
A variable, with all its values read.
Fields§
§name: StringIts name.
dimensions: Vec<Arc<str>>Its dimensions’ names, outermost first. Each is shared with every other variable along that dimension, so a header that names one dimension many times costs no copy per axis.
shape: Vec<u64>Its length along each dimension (the record count for the record dimension).
attributes: Vec<Attribute>Its attributes.
values: ValuesIts values, in row-major order (last dimension varying fastest).
Implementations§
Source§impl Variable
impl Variable
Sourcepub fn offset(&self, index: &[u64]) -> Option<usize>
pub fn offset(&self, index: &[u64]) -> Option<usize>
The row-major position of the value at index (one entry per dimension), or None if the
index has the wrong rank or is out of range.
Sourcepub fn packing(&self) -> Result<Packing, NetCdfError>
pub fn packing(&self) -> Result<Packing, NetCdfError>
How this variable’s stored values map to physical ones, from its attributes (see the module documentation).
§Errors
NetCdfError::Unsupported for character data, an _Unsigned attribute (whose values
this reader would read as signed), a packing or bound attribute that is not a single
number (two for valid_range), or valid_range given with valid_min or valid_max.
Sourcepub fn unpacked(&self, index: &[u64]) -> Result<Option<f64>, NetCdfError>
pub fn unpacked(&self, index: &[u64]) -> Result<Option<f64>, NetCdfError>
The physical value at index (one entry per dimension): Ok(None) where it is missing.
§Errors
As Variable::packing, and NetCdfError::Malformed if index is out of range.