CGKRIG2D
The cgKrig2D function interpolates a regularly or irregularly sampled set of points of
the form z = f(x, y) to produced a gridded 2D array using a statistical process known
as kriging. Kriging is a method of optimal interpolation based on regression against known
or observed z values of surrounding data points, weighted according to spatial covariance
values by various types of kriging model functions. Each grid location is estimated from
observed values at surrounding locations. It is often used with spatial data.
Like all interpolation schemes, kriging can produces spurious results in extreme cases,
but has the advantage of being able to compensate for the effects of data clustering and
other, similar problems better than other interpolation methods such as inverse distance squared,
splines, and triangulation methods. This particular version of Krig2D is orders of magnitude
faster than the version of Krig2D that was distributed with IDL through IDL 8.2.3.
An excellent explanation of the kriging process can be found here::
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z00000076000000.htm
http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=Semivariograms_and_covariance_functions
An explanation of the innovation that caused Krig2D to be made faster by several orders
of magnitude can be found here::
http://www.idlcoyote.com/code_tips/krigspeed.php
I've implemented the kriging mathematical models described in the following references::
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z00000076000000.htm
http://www.nbb.cornell.edu/neurobio/land/OldStudentProjects/cs490-94to95/clang/kriging.html
Categories
Math, Interpolation, Gridding
Examples
To create a dataset of N random points and determine the surface formed from such points::
n = 500 ;# of scattered points
seed = -121147L ;For consistency
x = RANDOMU(seed, n)
y = RANDOMU(seed, n)
; Create a dependent variable in the form a function of (x,y)
data = 3 * EXP(-((9*x-2)^2 + (7-9*y)^2)/4) + $
3 * EXP(-((9*x+1)^2)/49 - (1-0.9*y)) + $
2 * EXP(-((9*x-7)^2 + (6-9*y)^2)/4) - $
EXP(-(9*x-4)^2 - (2-9*y)^2)
params = [0.5, 0.0]
interpArray = cgKrig2D(data, x, y, EXPONENTIAL=params, XOUT=xout, YOUT=yout)
cgSurf, interpArray, xout, yout, /Save
cgPlots, x, y, data, PSYM=2, Color='red', /T3D
Author
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
History
Written, 15 Oct 2013, based on a fast varient of the Krig2D program in the IDL library.
Copyright
Copyright (c) 2013, Fanning Software Consulting, Inc.