pub struct Codebook {
pub book: Book,
/* private fields */
}Available on crate feature
encoder only.Expand description
One profile’s codebook for one variable: the arithmetic, and the block it was read from.
Fields§
§book: BookImplementations§
Source§impl Codebook
impl Codebook
Sourcepub fn from_metadata(block: &Map<String, Value>, name: &str) -> Result<Codebook>
pub fn from_metadata(block: &Map<String, Value>, name: &str) -> Result<Codebook>
The codebook a quantization block describes (the inverse of
metadata). Refuses a block whose code range does not follow from
its own parameters, since then it does not say one thing. Mirrors
codebook_from_metadata in xuebuild/quantize.py, check for check.
Sourcepub fn metadata(&self) -> Map<String, Value>
pub fn metadata(&self) -> Map<String, Value>
The block, as the document carries it and the metadata writes it.
Sourcepub fn nodata_code(&self) -> u16
pub fn nodata_code(&self) -> u16
The code no value maps to, which pads a chunk past the grid.
Sourcepub fn quantize_wide(&self, values: &[f64], codes: &mut [u16]) -> Result<()>
pub fn quantize_wide(&self, values: &[f64], codes: &mut [u16]) -> Result<()>
Sixteen-bit codes, for a series codebook: linear only, as the
registry’s seriesQuantization is.
Sourcepub fn is_wide(&self) -> bool
pub fn is_wide(&self) -> bool
Whether the codes need sixteen bits (code_dtype in the reference):
every other code of a consistent block is below its nodata code.
pub fn quantize(&self, values: &[f64], codes: &mut [u8]) -> Result<()>
pub fn as_linear(&self) -> Option<&LinearCodebook>
pub fn as_precipitation(&self) -> Option<&PrecipitationCodebook>
Trait Implementations§
Auto Trait Implementations§
impl Forget for Codebook
impl Freeze for Codebookwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<usize>: Freeze,
PhantomData<Bucket<String, Value>>: Freeze,
impl Move for Codebook
impl RefUnwindSafe for Codebook
impl Send for Codebook
impl Sync for Codebook
impl Unpin for Codebook
impl UnsafeUnpin for Codebookwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
PhantomData<Bucket<String, Value>>: UnsafeUnpin,
impl UnwindSafe for Codebook
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<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> ⓘ
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 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> ⓘ
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