Documentation for /home/davin/idl/socware/

Generated by IDLdoc

single page | use frames     summary     class     fields     routine details     file attributes

general/misc/

find_nearest_neighbor.pro


Routines

top source find_nearest_neighbor

result = find_nearest_neighbor(time_series, target_time, quiet=quiet, sort=sort)

Name: find_nearest_neighbor Purpose: Uses binary search on a time series to find the array element closest to the target time Input: time_series: monotonically increasing time series array (stored as doubles) target_time: time to search for in the time series (double) Keywords: quiet: suppress output of errors sort: sort the input array prior to searching Output: Returns the value in time_series nearest to the target_time (as a double) Returns -1 if there's an error Examples: >> print, find_nearest_neighbor([1,2,3,4,5,6,7,8,9], 4.6) 5 >> print, find_nearest_neighbor([5,4,3,7,8,2,4,6,7], 7.6, /sort) 8 $LastChangedBy: egrimes $ $LastChangedDate: 2014-02-06 12:09:24 -0800 (Thu, 06 Feb 2014) $ $LastChangedRevision: 14176 $ $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/misc/find_nearest_neighbor.pro $

Parameters

time_series
target_time

Keywords

quiet
sort

File attributes

Modification date: Thu Feb 13 16:43:48 2014
Lines: 27