Search code examples
delphidelphi-2007statistics

How to fill in the 'holes' in an irregular spaced grid or array having missing data?


Does anyone have a straight forward Delphi example of filling in a grid using Delaunay Triangles or kriging? Either method can fill a grid by 'interpolating.'

What do I want to do? I have a grid, similar to:

22  23  xx  17  19  18 05  
21  xx  xx  xx  17  18 07  
22  24  xx  xx  18  21 20  
30  22  25  xx  22  20 19  
28  xx  23  24  22  20 18  
22  23  xx  17  23  15 08  
21  29  30  22  22  17 09 

where the xx's represent grids cells with no data and the x,y coordinates of each cell is known. Both kriging and Delaunay Triangles can supply the 'missing' points (which of course, are fictitious, but reasonable values).

Kriging is a statistical method to fill in 'missing' or unavailable data in a grid with 'reasonable' values. Why would you need it? Principly to 'contour' the data. Contouring algorithms (like CONREC for Delphi http://local.wasp.uwa.edu.au/~pbourke/papers/conrec/index.html) can contour regularly spaced data. Google around for 'kriging' and 'Delphi' and you eventually are pointed to the GEOBLOCK project on Source Forge (http://geoblock.sourceforge.net/ ). Geoblock has numerous Delphi pas units for kriging based on GSLIB (a Fortran statistical package developed at Stanford). However all the kriging/delauney units are dependent on units refered to in the Delphi uses clause. Unfortunately, these 'helper' units are not posted with the rest of the source code. It appears none of the kriging units can stand alone or work without helper units that are not posted or in some cases, undefined data types.

Delaunay triangulation is described at http://local.wasp.uwa.edu.au/~pbourke/papers/triangulate/index.html. Posted is a Delphi example, pretty neat, that generates 'triangles.' Unfortunately, I haven't a clue how to use the unit with a static grid. The example 'generates' a data field on the fly.

Has anyone got either of these units to work to fill an irregular data grid? Any code or hints how to use the existing code for kriging a simple grid or using Delaunay to fill in the holes would be appreciated.


Solution

  • Code posted by Richard Winston on the Embarcadero Developer Newwork Code Central titled

    Delaunay triangulation and contouring code

    ( ID: 29365 ) demonstrates routines for generating constrained Delaunay triangulations and for plotting contour lines based on data points at arbitrary locations. Richard's code . These algorithms do not manipulate and fill-in the holes in a grid. They do provide a method for contouring arbitrary data and do not require a grid without missing values.

    enter image description here

    I still have not found an acceptable krieging algorithm in Pascal to actually fill-in the holesin a grid.