slv.measurements.mobile.location#

Where is the TRAX train, minute by minute: indoor (shed), yard, pass-by, route, stopped?

The TRAX trains sleep at a rail service center: trx01/trx02 at the Jordan River RSC (JRRSC, where the green line runs right past the yard’s north edge), trx03 at the Midvale RSC (MRSC, the old-train yard beside the red/blue line). Sometimes a train is parked outside on the yard tracks, sometimes inside the maintenance shed. The pipeline’s storage flag (GPS QAQC_Flag == 20) and the slv loader’s storage polygon lump everything at a yard together. This module separates them from the GPS behaviour, at one-minute resolution, so that outdoor minutes can be kept even when the train is not on the line and indoor minutes dropped:

  • depot (indoor) — stationary at a yard and the GPS fix is degraded: the per-minute position scatter is metres (multipath under the roof, the “crazy” GPS) and the satellite count is low. JRRSC site visits (which happen inside the shed) show 2.5–7 m scatter and 6–7 satellites; parked outside the scatter is < 0.3 m with 8–12 satellites. The scattered fixes’ medians cluster inside the shed footprints (load_depot_footprint(), derived from 2025 data).

  • yard (outdoor) — stationary (or creeping) with a clean fix inside a storage polygon (+ YARD_BUFFER). Includes yard tracks within 50 m of the main line.

  • line (outdoor) — moving (max speed ≥ MOVING_SPEED m/s) on a track (within LINE_DISTANCE m) within NEAR_YARD m of a storage polygon: a pass-by, or arriving/leaving. Kept separate so pass-by data can be evaluated.

  • route (outdoor) — moving on a track anywhere else (normal operation).

  • stopped (outdoor) — stationary on a track away from the yards (a station stop, a layover).

  • unknown — no usable GPS in the minute, or a position that cannot be trusted: more than OFF_TRACK m from any TRAX track (GPS junk, or a siding missing from the line geojson), or within NEAR_YARD m of a storage polygon but neither on a track nor inside the yard buffer (multipath ejecta from the shed).

indoor in the output is True for depot, False for the four outdoor states, and NA for unknown; yard_name says which service center the minute is at.

Supporting evidence that is not used by the classifier but is worth plotting: inside the heated depot the roof temperature sits at 22–23 °C with low RH, ozone goes to ~0, CO2 climbs; none of these are season-independent on their own. Battery voltage (cr1000) separates powered from train power off (< POWER_OFF_V), not depot from yard, so it is returned as a separate powered flag.

Typical use:

feat = location_features(gps, cr1000=logger)  # 1-min feature table
states = classify_location(feat)  # per-minute state
intervals = state_intervals(states)  # start/end/state table

gps needs a datetime index and Latitude_deg, Longitude_deg; Speed_m_s and N_Sat are optional. Speed is missing wherever only GPGGA was logged (lin-group GPS Dec 2015 – 19 Jan 2018; horel pilot logger Nov 2014 – Nov 2018): there moving comes from the position-derived speed_est instead. Either the lin-group GPS (uataq.read_data ('trx01', 'gps', lvl='qaqc')) or the horel-group logger GPS (read_horel_cr1000()) works; read_trax_gps() picks by era (lin GPS for the pilot years, horel logger from 19 Nov 2018, which runs on its own battery and keeps recording when train power is off). trx03 has no lin-group GPS; its horel record starts Nov 2019.

Attributes

MOVING_SPEED

Speed (m/s, per-minute maximum) at or above which the train counts as moving.

MOVING_SPEED_EST

Threshold (m/s) for the position-derived speed estimate used when no speed was recorded (GPGGA-only eras): displacement between the minute medians one minute before and after, over 120 s.

LINE_DISTANCE

Distance (m) from a TRAX track within which a moving train is "on the line".

SCATTER_M

Per-minute position std (m, max of x/y) above which the fix is degraded.

LOW_NSAT

Satellite count at or below which the fix is degraded (only if N_Sat present).

YARD_BUFFER

scattered depot fixes leak past its edge.

NEAR_YARD

Radius (m) around the storage polygon inside which an off-line, off-yard minute is multipath ejecta from the depot rather than a real stop → unknown.

OFF_TRACK

Distance (m) from any TRAX track beyond which a minute is unknown (a train is never that far off the mapped lines; catches GPS junk and unmapped sidings).

POWER_OFF_V

Logger battery voltage below which train power is off (charging level is ~13–14 V).

SMOOTH_MIN

Centred window (minutes) for the majority vote that removes single-minute flips.

Functions

classify_location

Classify each row of location_features() into one of STATES.

label_observations

Per-observation state from the per-minute table (time floored to the minute).

location_features

Per-freq GPS features that the classifier needs (plus power, if available).

state_intervals

Run-length table of a per-minute state series: start, end, state, minutes.