FUNCTION calc_t_index, time, tarray, t_in_s, delta_t, utbase ;Calculate the index of tarray that has the time nearest to time in dd-mm-yy hh:mm:ss.sss ; tarray is in seconds of day; utbase is seconds after 1-jan-1979. t_in_s = anytim(time,/utime) - utbase t_index = where(tarray + delta_t/2.0 gt t_in_s) t_index = t_index(0) RETURN, t_index end