gis-tools-ts - v0.6.0
    Preparing search index...

    Class KrigingInterpolator<T>

    Kriging Interpolator

    Interpolation using the Kriging method. Find the best fit curve for a given set of data. You can either compute the semivariance or the variogram (expected value).

    The various variogram models can be interpreted as kernel functions for 2-dimensional coordinates a, b and parameters nugget, range, sill and A. Reparameterized as a linear function, with w = [nugget, (sill-nugget)/range], this becomes:

    • Gaussian: k(a,b) = w[0] + w[1] * ( 1 - exp{ -( ||a-b|| / range )2 / A } )
    • Exponential: k(a,b) = w[0] + w[1] * ( 1 - exp{ -( ||a-b|| / range ) / A } )
    • Spherical: k(a,b) = w[0] + w[1] * ( 1.5 * ( ||a-b|| / range ) - 0.5 * ( ||a-b|| / range )3 )

    Notice the σ2 (sigma2) and α (alpha) variables, these correspond to the variance parameters of the gaussian process and the prior of the variogram model, respectively. A diffuse α prior is typically used; a formal mathematical definition of the model is provided below.

    The variance parameter α of the prior distribution for w should be manually set, according to:

    • w ~ N(w|0, αI)

    Using the fitted kernel function hyperparameters and setting K as the Gram matrix, the prior and likelihood for the gaussian process become:

    • y ~ N(y|0, K)
    • `t|y ~ N(t|y, σ2I)
    import { KrigingInterpolator } from 'gis-tools-ts';
    import type { VectorPoint } from 'gis-tools-ts';

    // We have m-value data that we want to interpolate
    interface TempData { temp: number; }

    // given a point we are interested in
    const point: VectorPoint = { x: 20, y: -40 };
    // get a collection of points relative to the point
    const data: VectorPoint<TempData>[] = [...];

    // interpolate
    const interpolator = new KrigingInterpolator<TempData>(data, 'gaussian', (p) => p.m.temp);
    const interpolatedValue = interpolator.predict(point);

    Type Parameters

    • T extends MValue = Properties
    Index

    Constructors

    Methods

    Constructors

    • Type Parameters

      • T extends Properties = Properties

      Parameters

      • refData: VectorPoint<T>[]

        reference data to interpolate from

      • model: KrigingModel = 'gaussian'

        kriging model

      • getValue: GetInterpolateValue<T> = defaultGetInterpolateCurrentValue

        function to get value from reference data. Can be the z value or a property in the m-values

      • sigma2: number = 0

        variance parameter of the gaussian model

      • alpha: number = 100

        diffuse α prior of the variogram model

      Returns KrigingInterpolator<T>

    Methods

    • Model prediction

      Parameters

      • point: VectorPoint

        point to interpolate to

      Returns number

      • predicted value
    • Variance prediction

      Parameters

      • point: VectorPoint

        point to interpolate to

      Returns number

      • predicted variance