clouddrift.pairs.pair_time_distance#
- clouddrift.pairs.pair_time_distance(time1: list[float] | ndarray[float] | Series | DataArray, time2: list[float] | ndarray[float] | Series | DataArray) ndarray[float] [source]#
Given two arrays of times (or any other monotonically increasing quantity), return the temporal distance between all pairs of times.
Parameters#
- time1array_like
First array of times.
- time2array_like
Second array of times.
Returns#
- distancenp.ndarray[float]
Array of distances between all pairs of times.
Examples#
>>> time1 = np.arange(4) >>> time2 = np.arange(2, 6) >>> pair_time_distance(time1, time2) array([[2, 1, 0, 1], [3, 2, 1, 0], [4, 3, 2, 1], [5, 4, 3, 2]])