[R] Using Akima with nearly-gridded data

Tom Hansen tomh at uwm.edu
Thu Jun 7 19:38:04 CEST 2007


I am using the Akima interpolation package to generate an interpolated 
color contour plot.  It is working very well, except for one problem.  
The data that I have represents real-time readings from a thermistor 
string vs. time, so the data points are often very nearly in a 
rectangular array, since the thermistors are read at regular time 
intervals and they are equally spaced physically.  However, readings are 
sometimes delayed or missed, so I cannot assume that it will be a 
regular grid.  Hence Akima.

However, Akima simply will not work if the first three points are 
collinear (which is easy to get around), and it often leaves blank 
triangles in seemingly arbitrary places in the plot.  It seems that the 
algorithm in Akima for building the triangles that it uses internally to 
do the interpolation is having a very hard time dealing with nearly 
regularly-spaced data points.

The only way I have found to get Akima to work, is to slightly "perturb" 
the data points by adding random seconds to the times (the temperatures 
are read every 5 minutes, so a few seconds aren't going to matter).  
More recently I have had some luck simply feeding the points into the 
algorithm in a pseudo-randomized order.  But then, of course, the 
outcome is largely the luck of the draw and sometimes the plot still 
ends up with a scattering of white triangles, or artifacts on the edges 
of the plot.

Does anyone have any suggestions as to how to make this work consistently?

-- 
Tom Hansen
Senior Information Processing Consultant
UWM Great Lakes WATER Institute
www.glwi.uwm.edu
tomh at uwm.edu



More information about the R-help mailing list