This script has the next actions: finds the set of elements in input_array that are closest to elements in target_array and records the indices of the elements in target_array that are within tolerance, tol, of their closest match. Also it records the indices of the elements in target_array that are outside tolerance, tol, of their match.
For example, given an array of observations with irregular observation times along with an array of times of interest, this routine can be used to find those observations that are closest to the times of interest that are within a given time tolerance.