INDEX_OF_NEAREST_KPB
Name
INDEX_OF_NEAREST_KPB
Purpose
This function finds the index of the element of x whose value is
nearest to x0. This is primarily useful for finding the index of
a point in an ordered 1-dimensional array. For example, if x is
an array of latitudes, this function will return the index of the
element of the array that is closest to the latitude x0.
If there are multiple elements in x that are the same distance from
x0, this function returns the first one.
Category
Array utility.
Calling Sequence
i = INDEX_OF_NEAREST_KPB(x, x0)
Input
x : array of values to search.
x0 : value to search for.
Keywords
None.
Output
Index of element nearest to x0.
Modification History
Kenneth P. Bowman, 1999-04.
Department of Atmospheric Sciences
Texas A&M University
College Station, TX 77843-3150
http://idl.tamu.edu