lair.transects#

Metrics on mobile-platform transect matrices.

A transect matrix is a 2-D array obs[transit, point] of a species measured on repeated transits of a fixed route, resampled onto fixed along-route points (NaN where a transit has no data at a point). Persistence questions are answered per point:

  • enhancement() — obs minus each transit’s own low percentile (removes the

    boundary-layer / background cycle transit by transit)

  • detection_frequency() — fraction of transits enhanced above a threshold

  • magnitude() — mean or median enhancement, over detected transits or all

  • transit_times() — one representative timestamp per transit

  • profile() — detection frequency and magnitude binned by hour / weekday / month

  • along_route_distance() — cumulative geodesic distance of the points [km]

Building the matrix from a georeferenced time series (the transect builder, after Mitchell et al. 2018’s algorithm):

  • lag_positions() — put each sample where the sampled air was taken in (inlet lag)

  • snap_to_route() — nearest fixed route point of each sample

  • split_transits() — cut the along-route coordinate into one-way transits at the

    reversals of travel and at time gaps

  • transect_matrix() — average the samples onto [transit, point]

Everything is plain numpy; the platform-specific file formats live in the calling package (e.g. slv.measurements.mobile for TRAX). Times are POSIX seconds (float) or datetime64.

Functions

along_route_distance

Cumulative geodesic distance [km] along the ordered route points (WGS84).

detection_frequency

Fraction of transits (with data at the point) whose enhancement exceeds threshold.

enhancement

Enhancement above each transit's own baseline_q-th percentile along the route.

lag_positions

Positions where the air of each sample was actually taken in.

magnitude

Per-point enhancement magnitude: stat ("median" | "mean") over detected transits (enh > threshold) or over all transits with data (threshold=None).

merge_route_points

Merge the fixed points of several routes into one network point set.

pool_routes

Stack per-route [transit, point] matrices onto the network points.

profile

Detection frequency and median magnitude per point, binned by by ("hour", "weekday" or "month") of the transit time.

robust_z

Per-transit robust z-score of the enhancement: (enh - median) / (1.4826 * MAD), median and MAD taken along each transit's route points.

snap_to_route

Nearest route point of each sample: (index, distance), index -1 beyond max_dist.

split_transits

Cut a platform's along-route coordinate into one-way transits.

transect_matrix

Average samples onto a [transit, point] matrix.

transit_times

One timestamp per transit from a time[transit, point] matrix (POSIX seconds or datetime64); NaT for transits with no data.