Interpolating at a single point


Slowness

Natgrid provides for interpolation at a single point but, as indicated and documented in the efficiency module, interpolation at single points is very expensive and, in general, should be used only for filling in a few missing data values.

How to do it

For the same input dataset, in order to avoid having to calculate the natural neighbor relationships every time interpolation is done on a single point, interpolation at single points is implemented as a three step process:
  1. Invoke an initialization procedure that calculates the natural neighbor relationships. This procedure is NNPNTINITS in Fortran and c_nnpntinits in C.

  2. Do the interpolation at the desired points. The procedure for this is NNPNTS in Fortran and c_nnpnts in C.

  3. Terminate single point mode. This is done using the procedure NNPNTEND in Fortran and c_nnpntend in C.
You can set any control parameters you want before interpolating at individual points, except slopes and aspects cannot be calculated while in single point mode.

See Example 6 for Fortran and C examples of interpolation in single point mode.

Due to implementation details, the values calculated in single point mode may differ slightly from values at the same coordinates when calculated using a grid.

If you have many datasets defined on the same input grid and need to interpolate at certain points in all datasets, then, in the interests of efficiency, you may want to retrieve the natural neighbors and weights for those points and calculate the interpolated vaules (sum of weights times function values) yourself. Depending on the language and precision you are using, one of the procedures NNGETWTS, NNGETWTSD, c_nngetwts, or c_nngetwtsd can be used for this. Example 10 illustrates how to do this.


home | contents | defs | params | procedures | exmpls | index