# natgrids, natgridd

Routines that interpolate from 2D random data to a rectangular output grid. These routines are part of the Natgrid package which implements a natural neighbor interpolation method.

## Synopsis

```    function natgrids(
x[*]  : float,
y[*]  : float,
z[*]  : float,
xo[*] : float,
yo[*] : float
)

function natgridd(
x[*]  : double,
y[*]  : double,
z[*]  : double,
xo[*] : double,
yo[*] : double
)

```

## Arguments

x
1D array of any length (npts) containing the X coordinates of the input data points
y
1D array of length npts containing the Y coordinates of the input data points
z
1D array of length npts containing the functional values of the input data points (z(i) is the value of the input function at coordinate (x(i), y(i)) for i=1,npts).
xo
1D array of any length (NumXOut) containing the X coordinates of the output data grid. The values in xo must be increasing, but need not be equally spaced.
yo
1D array of any length (NumYOut) containing the Y coordinates of the output data grid. The values in yo must be increasing, but need not be equally spaced.

## Description

Both the natgrids and natgridd functions use a natural neighbor interpolation method for taking a set of randomly-spaced two-dimensional coordinates with function values at those coordinates and return a set of interpolated function values at coordinates in a user-specified rectangular grid. The results are returned in a 2D float array dimensioned NumXOut x NumYOut. natgrids is the single precision version and natgridd is the double precision version.

If an error code is returned, you can look up the meaning of the code in the Natgrid documentation at the URL:

http://ngwww.ucar.edu/ngdoc/ng/ngmath/natgrid/errors.html#ErrorTable

## Example

```begin
NumXOut = 21
NumYOut = 21
ISLIM = 6
x = new((/ISLIM/),double)
y = new((/ISLIM/),double)
z = new((/ISLIM/),double)
xi = new((/NumXOut/),double)
yi = new((/NumYOut/),double)

x = (/0.00, 1.00, 0.00, 1.00, 0.40, 0.75/)
y = (/0.00, 0.00, 1.00, 1.00, 0.20, 0.65/)
z = (/0.00, 0.00, 0.00, 0.00, 1.25, 0.80/)

xc = 1./(NumXOut-1.)
xi = ispan(0,NumXOut-1,1) * xc

yc = 1./(NumYOut-1.)
yi = ispan(0,NumYOut-1,1) * yc

zi = natgridd(x, y, z, xi, yi)
end
```

### Reference Manual Control Panel

\$Revision: 1.8 \$ \$Date: 1999/03/12 20:57:38 \$