krigekit.variogram_structure#

The complete theoretical variogram for one variable pair.

A VgmStructure owns an ordered list of VgmComponent objects and nothing else – no observations, empirical clouds, fit results, or plotting state. Nested product structures are evaluated exactly like the Fortran engine: a component with product=True multiplies the immediately preceding component in covariance space, and each product group is added to the total.

Classes#

VgmStructure

An ordered set of nested variogram components for one variable pair.

Module Contents#

class krigekit.variogram_structure.VgmStructure(components=None, name=None)#

An ordered set of nested variogram components for one variable pair.

Create a structure from components or flat component specs.

property ncomponent#

Number of nested components (always len(self.components)).

copy()#

Return an independent copy with copied components.

clear()#

Remove all components and return self.

validate()#

Validate every component and return self.

set_vgm(vtype, nugget=0.0, sill=1.0, a_major=1.0, a_minor1=None, a_minor2=None, azimuth=0.0, dip=0.0, plunge=0.0, append=True, product=False, name=None)#

Add one nested component.

Parameters mirror krigekit.Kriging.set_vgm() (without ivar and jvar). Pass append=False to clear existing components first, or product=True to multiply this component with the preceding one in covariance space.

set_structure_params(index=0, **params)#

Update fields on one component, with validation.

index is a zero-based component position. Accepts any VgmComponent field; the component is rebuilt and revalidated.

set_anisotropy(index=None, **params)#

Update anisotropy on one, several, or all components.

index accepts None (all components), one zero-based integer, or a sequence of integers. Keyword arguments are forwarded to VgmComponent.set_anisotropy() (a_minor1, ratio_minor1 / anis1, azimuth, …).

covariance(distance)#

Evaluate the nested/product covariance at scalar lag distance(s).

property cov0#

Covariance at zero lag, including nugget and product groups.

variogram(distance)#

Evaluate gamma(h) = C(0) - C(h) at scalar lag distance(s).

calc_covariance(coord0, coord1, pairwise=False)#

Evaluate covariance between coordinates, applying anisotropy.

coord0 and coord1 have shape (dim,) or (n, dim). By default matching rows are compared and a single point is broadcast; pairwise=True returns the full (n0, n1) matrix.

calc_variogram(coord0, coord1, pairwise=False)#

Evaluate semivariogram values between coordinates with anisotropy.

fit(data, *, kind='auto', p0=None, x_col=('distance', 'mean'), y_col=('variogram', 'mean'), sigma_col=None, weight_col=None, weights=None, bounds=None, fit_nugget=True, inplace=True, **kwargs)#

Fit sills, major ranges, and nugget to an averaged variogram.

Returns a krigekit.variogram_fitting.FitResult. Fitted values are written into copies of the current components, so model type, anisotropy, and name are preserved. kind selects the fit; only the "isotropic" path (default "auto" for a distance/variogram table) is implemented here – use VariogramModel.fit_anisotropy for directional fits.

to_kriging_specs(replace=False)#

Return flat specs accepted by Kriging.set_vgm.

With replace=True the first spec carries append=False so it clears any existing model for the pair; later specs append.

to_temporal_specs()#

Return specs accepted by SpaceTimeKriging.set_vgm_temporal.

The one-dimensional a_major value is renamed to at_k; spatial anisotropy fields are omitted because temporal marginals are 1-D.

apply_to(kriging, ivar, jvar, replace=True)#

Apply this structure to a krigekit.Kriging object.