Provided by: libncarg-dev_6.3.0-6build1_amd64

**NAME**

SHGETNP - find the nearest points to a specified point in 3-space.

**SYNOPSIS**

CALL SHGETNP (PX, PY, PZ, N, X, Y, Z, IFLAG, IWK, RWK, NP, IER)

**DESCRIPTION**

PX (real,input) The X coordinate value for a point P whose nearest neighbor is to be found. PY (real,input) The Y coordinate value for a point P whose nearest neighbor is to be found. PZ (real,input) The Z coordinate value for a point P whose nearest neighbor is to be found. X (real, input) An array containing the X coordinates of the input data points. Y (real, input) An array containing the Y coordinates of the input data points. Z (real, input) An array containing the Z coordinates of the input data points. IFLAG (integer, input) A flag that equals 0 if this is the first call to this subroutine for the given dataset and equals 1 otherwise. IRK (integer, input) An integer workspace dimensioned for at least 2*N. RWK (real, input) A real workspace dimensioned for at least 11*N+6. NP (integer, output) An index such that (X(NP),Y(NP),Z(NP)) is the nearest input data point to P. NP = 0 if IER .NE. 0. On successive calls to this subroutine after the first (that is when IFLAG=1) you can find the Mth closest point to (PX,PY,PZ) with the Mth call. IWK and RWK should not be modified between calls to SHGETNP if you are wanting to find successive nearest neighbors. IER (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 man page for shgrid_errors for details.

**USAGE**

SHGETNP is called to find the nearest point to a specified point in 3-space. Successive calls to SHGETNP will determine the point nearest the specified point exclusive of the points found in previous calls, i.e. successive calls can be used to find the N nearest points for any N between one and the maximum number of points in the input dataset.

**ACCESS**

To use SHGETNP, load the NCAR Graphics library ngmath.

**SEE** **ALSO**

shgrid, shseti, shgeti, shgrid_params. Complete documentation for Shgrid is available at URL http://ngwww.ucar.edu/ngdoc/ng/ngmath/shgrid/shhome.html

**COPYRIGHT**

Copyright (C) 1997-2000 University Corporation for Atmospheric Research The use of this Software is governed by a License Agreement.