Interpolating at a single point
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.
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:
You can set any
you want before interpolating
at individual points, except
aspects cannot be calculated
while in single point mode.
- Invoke an initialization
calculates the natural
neighbor relationships. This procedure is
NNPNTINITS in Fortran
and c_nnpntinits in C.
- Do the interpolation at the desired points. The procedure
for this is NNPNTS
in Fortran and c_nnpnts
- Terminate single point mode. This is done using the
procedure NNPNTEND in
c_nnpntend in C.
for Fortran and C examples of interpolation in single
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
can be used for this.
Example 10 illustrates
how to do this.