Skip to main content

Conversion

Enum Conversion 

Source
pub enum Conversion {
Show 15 variants Identity { accepted_units: Option<Vec<String>>, }, Celsius, SoilTemperature, PrecipitationRate, PrecipitationAccumulation, PascalToHectopascal, MetreToKilometre, MassRatioToGPerKg, ProportionToPercent, CloudCover, DegreesTrue, GeopotentialToMetres, MassDensityToMicrograms, PerSecondTo1e5, CodeTable { table: String, },
}
Available on crate feature encoder only.
Expand description

The unit rule of one variable: the arithmetic that takes a record’s values to the variable’s unit, and the spellings a record may carry. The semantics are in units.rs.

Variants§

§

Identity

Identity; acceptedUnits lists the spellings, no list accepts any.

Fields

§accepted_units: Option<Vec<String>>
§

Celsius

§

SoilTemperature

§

PrecipitationRate

§

PrecipitationAccumulation

§

PascalToHectopascal

§

MetreToKilometre

§

MassRatioToGPerKg

§

ProportionToPercent

§

CloudCover

§

DegreesTrue

§

GeopotentialToMetres

§

MassDensityToMicrograms

§

PerSecondTo1e5

§

CodeTable

Fields

§table: String

Implementations§

Source§

impl Conversion

Source

pub fn accepted_units(&self) -> Option<Vec<&str>>

The compacted spellings the rule accepts a record under, or None for a none rule that accepts any. A code-table rule also accepts any spelling that contains its table or 0=no. Mirrors rules.accepted_units.

Source

pub fn accepts(&self, unit: &str) -> bool

Whether a record under unit is one this rule reads. Mirrors rules.accepts.

Source

pub fn expression(&self, unit: &str) -> Result<String>

The raster expression one record takes under unit: the rule’s arithmetic alone, no clamp, in GDAL’s A spelling. The two inspection paths (gdal.py, inspect.rs) compare it for identity; nothing writes it. An error for a spelling the rule does not accept. Mirrors rules.expression.

Source

pub fn convert(&self, unit: &str, values: &mut [f64]) -> Result<()>

One plane’s values taken to the published unit, by the rule’s arithmetic under unit, in place: one operation per value, in f64, the operation rules.convert runs. A temperature’s unit is read through temperature_unit, after the soil read-through for a soil temperature; a direction is reduced modulo 360 so a record’s 360 lands on the codebook’s 0 (every value is non-negative there, so this is numpy’s mod). A spelling the rule does not scale under takes the identity, which is how a series already in the published unit is left alone.

Trait Implementations§

Source§

impl Clone for Conversion

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Conversion

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Conversion

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Conversion

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Conversion

Auto Trait Implementations§

§

impl Forget for Conversion

§

impl Freeze for Conversion

§

impl Move for Conversion

§

impl RefUnwindSafe for Conversion

§

impl Send for Conversion
where RawVecInner: Send,

§

impl Sync for Conversion
where RawVecInner: Sync,

§

impl Unpin for Conversion
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for Conversion

§

impl UnwindSafe for Conversion
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.