clouddrift.pairs.pair_time_overlap#
- clouddrift.pairs.pair_time_overlap(time1: list[float] | ndarray[float] | Series | DataArray, time2: list[float] | ndarray[float] | Series | DataArray, distance: float = 0) tuple[ndarray[int], ndarray[int]][source]#
- Given two arrays of times (or any other monotonically increasing quantity), return indices where the times are within a prescribed distance. - Although higher-level array containers like xarray and pandas are supported for input arrays, this function is an order of magnitude faster when passing in numpy arrays. - Parameters#- time1array_like
- First array of times. 
- time2array_like
- Second array of times. 
- distancefloat
- Maximum distance within which the values of - time1and- time2are considered to overlap. Default is 0, or, the values must be exactly the same.
 - Returns#- overlap1np.ndarray[int]
- Indices of - time1where its time overlaps with- time2.
- overlap2np.ndarray[int]
- Indices of - time2where its time overlaps with- time1.
 - Examples#- >>> time1 = np.arange(4) >>> time2 = np.arange(2, 6) >>> pair_time_overlap(time1, time2) (array([2, 3]), array([0, 1])) - >>> pair_time_overlap(time1, time2, 1) (array([1, 2, 3]), array([0, 1, 2])) 
