lair.transects.transit_times#

lair.transects.transit_times(time, stat='median')[source]#

One timestamp per transit from a time[transit, point] matrix.

Parameters:
  • time (np.ndarray) – Time matrix time[transit, point], in POSIX seconds or datetime64, as from transect_matrix().

  • stat (str, optional) – How to reduce each transit’s times: "median" (the default), "min" or "max".

Returns:

pd.DatetimeIndex – One naive (UTC) time per transit; transits with no data get NaT.

Return type:

DatetimeIndex

See also

profile

Bins the metrics by these times.

transect_matrix

Gives the time matrix.

Examples

Two transits of three points; the second has a point without a time, which the median skips:

>>> import numpy as np
>>> from lair.transects import transit_times
>>> time = np.array([[0, 60, 120.0], [3600, 3660, np.nan]])
>>> list(transit_times(time).strftime("%H:%M:%S"))
['00:01:00', '01:00:30']
>>> list(transit_times(time, "max").strftime("%H:%M:%S"))
['00:02:00', '01:01:00']