Kriging interpolation

Syntax: Calculate lags (distances)
float lags(float xcoords, float ycoords, float &angle, float &lag, float &nlags)

Calculate theoretical semi-variogram for each of the four models
float sphsemiv(float lags, float nugget, float sill, float limit)
float expsemiv(float lags, float nugget, float sill, float limit)
float ransemiv(float lags, float nugget)
float linsemiv(float lags, float factor, float exponent)

Estimate the value of a bivariate random function using kriging
float krig2d(float xcoords, float ycoords, float zvals, float &numpoints, string model, string stdDevs, float &nugget, float sills, float limit, float &factor, float &exponent, float &nx, float &ny, float &searchRadius)

Calculate an experimental semi-variogram
float xpmsemiv(float xcoords, float ycoords, float zvals, float &numpoints, string pairDataset, float &angle, float &tolerance, float &lag, float &nlags)

Parameters: The following descriptions apply for all functions. For any of the parameters above that are preceded with an "&" you can either specify a value to use or specify a dataset set to undef and the calculated value will be written back to the dataset.
  • xcoords, ycoords and zvals - the input datapoints.
  • The angle in which to look. 0 < angle <= 360. Default value: 45. 
  • The lag. lag > 0. Default value: 1.
  • nlags is the number of lags. 4 < nlags <= 100. Default value: 20.
  • lags is the output from lags(). 
  • The nugget is the offset value of the point where the theoretical curve intersects the Y-axis
  • The sill is the limit at which the differences between neighbouring points are no longer taken into consideration. Data points beyond this position will have no influence on the calculation.
  • The limit is the maximum distance from the original point beyond which neighbours will have no affect on the value.
  • y = factor * x^exponent.
    factor > 0, 0 < exponent < 2. Default value for both: 1.
  • If numpoints is not specified, the number of input points is used.
  • The theoretical semi-variogram model can be either "spherical" (default), "exponential", "random" or "linear".
  • If a dataset is specified in stdDevs, then it is used to store the calculated standard deviations.
  • nx and ny are the number of grid nodes in the x and y directions.
  • If pairDataset is specified, then it is used to store the number of sample pairs for each lag.
  • 0 < tolerance <= 90. Default value: 10
Code sample:
#taken from $UNIDIR\example\Gsharp\samples\krig.gsl

reset all;
import_report("$UNIDIR/example/Gsharp/samples/bluedata.dat");
Experimental = xpmsemiv(Xpos, Ypos, Blue,,"samplePairs");
krig_lags = lags(Xpos,Ypos);
Spherical = sphsemiv(krig_lags, 2000,240000,11);
Exponential = expsemiv(krig_lags, 2000, 240000, 11);
Random = ransemiv(krig_lags, 2000);
Linear = linsemiv(krig_lags, 27000,1);

Xgrid = range(1510//1535,26);
Ygrid = range(775//805,31);
SphEstimation = krig2d(Xpos,Ypos,Blue,,"spherical","krig_deviation",
                         2000,240000,11,,,Xgrid,Ygrid);

 

 

.