pub struct Variogram {
pub model: VariogramModel,
pub nugget: f64,
pub sill: f64,
pub range: f64,
}Expand description
A fully-specified variogram: a VariogramModel plus its nugget, partial
sill and range. Evaluate the semivariance with gamma.
Construct via Variogram::new, which validates the parameters (a valid
variogram is what keeps the ordinary-kriging system non-singular).
Fields§
§model: VariogramModelStructured-component family.
nugget: f64Nugget effect c₀ ≥ 0 — the discontinuity at the origin.
sill: f64Structured partial sill c ≥ 0 — the correlated variance.
range: f64Range a > 0 (practical range for exponential/Gaussian).
Implementations§
Source§impl Variogram
impl Variogram
Sourcepub fn fit(
model: VariogramModel,
exp: &ExperimentalVariogram,
) -> Result<Variogram>
pub fn fit( model: VariogramModel, exp: &ExperimentalVariogram, ) -> Result<Variogram>
Fit a model-shaped variogram to exp by pair-count weighted least
squares (see the module docs).
Returns the fitted Variogram (nugget, partial sill and range). Errors
with AlgoError::EmptyInput on an empty experimental variogram, and
propagates Variogram::new’s validation (e.g. a degenerate all-zero
fit). For VariogramModel::Nugget the fit is the weighted-mean
semivariance with a nominal (unused) range.
Source§impl Variogram
impl Variogram
Sourcepub fn new(
model: VariogramModel,
nugget: f64,
sill: f64,
range: f64,
) -> Result<Variogram>
pub fn new( model: VariogramModel, nugget: f64, sill: f64, range: f64, ) -> Result<Variogram>
Build a variogram, validating the parameters.
Requires nugget ≥ 0, sill ≥ 0, range > 0 (the range is still
required — and must be finite/positive — for the Nugget model even
though it is unused), and that the model produces a positive
semivariance at positive lag. Because the Nugget model ignores sill
(γ(h>0) = c₀), a Nugget with nugget = 0 is rejected here — it would
otherwise pass a naïve nugget + sill > 0 check yet yield an all-zero Γ
and a singular kriging system (surfacing at krige-time as a bogus
“duplicate points” error). Invalid parameters yield
AlgoError::InvalidArgument.
Sourcepub fn total_sill(&self) -> f64
pub fn total_sill(&self) -> f64
Total sill c₀ + c — the plateau the semivariance approaches at large
lags (reached exactly at h ≥ a for the spherical model).
Sourcepub fn gamma(&self, h: f64) -> f64
pub fn gamma(&self, h: f64) -> f64
Semivariance γ(h) at lag distance h ≥ 0.
γ(0) = 0. For h > 0 the result is c₀ (nugget) plus the structured
component of self.model. A negative h is treated
as its absolute value (a variogram is a function of the lag magnitude).
Trait Implementations§
impl Copy for Variogram
Source§impl<'de> Deserialize<'de> for Variogram
impl<'de> Deserialize<'de> for Variogram
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<&Variogram> for SpatialVariogram
impl From<&Variogram> for SpatialVariogram
Source§impl From<Variogram> for SpatialVariogram
impl From<Variogram> for SpatialVariogram
impl StructuralPartialEq for Variogram
Auto Trait Implementations§
impl Freeze for Variogram
impl RefUnwindSafe for Variogram
impl Send for Variogram
impl Sync for Variogram
impl Unpin for Variogram
impl UnsafeUnpin for Variogram
impl UnwindSafe for Variogram
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.