# ncl_c_shgrid - Man Page

interpolate random data in 3-space using a modified Shepard's algorithm

## Function Prototype

```float *c_shgrid(int, float [], float [], float [], float [],
int, int, int, float [], float [], float [], int*);```

## Synopsis

```float *c_shgrid (n, x[], y[], z[], f[], nxo, nyo, nzo,
xo[], yo[], zo[], ier);```

## Description

n

(integer,input) The number of input data points (n > 9).

xi

(float, input) An array dimensioned for n containing the X coordinate  values for the input function.

yi

(float, input) An array dimensioned for n containing the Y coordinate  values for the input function.

zi

(float, input) An array dimensioned for n containing the Z coordinate  values for the input function.

f

(float, input) An array containing the functional values of  the input function -- f[k] is the functional value at (xi[k], yi[k], zi[k]) for k=0,n-1.

nxo

(integer, input) The number of X coordinate  values to be calculated for the output grid.

nyo

(integer, input) The number of Y coordinate  values to be calculated for the output grid.

nzo

The number of Z coordinate values to be calculated for the output grid.

xo

(float, input) An array dimensioned for nxo containing the X coordinates of the output grid.

yo

(float, output) An array dimensioned for nyo containing the Y coordinates of the output grid.

zo

(float, output) An array dimensioned for nzo containing the Z coordinates of the output grid.

ier

(pointer to integer, output) An error return value.  If *ier is returned as 0, then no errors were  detected. If *ier is non-zero, then refer to the error list in the error  table for details.

## Usage

c_shgrid is called to interpolate randomly spaced data in 3-space.  c_shgrid uses a modified Shepard's algorithm to construct an  interpolatory surface.

c_shgrid returns a pointer to a linear array of data that is the interpolation grid stored in row-major order. That is, if out is declared as

`  float *out;`

and we set:

`  out = c_shgrid(n, x, y, z, f, nxo, nyo, nzo, xo, yo, zo, ier);`

then out[nz*ny*i + nz*j + k] is the approximation function value  at coordinate point (xo[i], yo[j], zo[k]) for 0 <= i < nx, 0 <= j < ny, and 0 <= k < nz. The space  for out is allocated internal to c_shgrid and is nx*ny*nz floats in size.

## Access

To use c_shgrid, load the NCAR Graphics library ngmath.