Elevation: skip near-zero dropout values mid-recording
Devices (Apple Watch, some GPS units) record 0.0 when they lose barometric/GPS lock mid-activity. The old accumulation committed these as real sea-level points, inflating both gain and loss by the current elevation (e.g. 792m dropout on the Cosmo Walk added ~1584m of phantom gain+loss). Fix: skip any elevation value < 1.0m when the current committed elevation is significantly above zero (> threshold). Gradual legitimate descents to sea level are unaffected because intermediate values are committed along the way. Add --recompute-elevation flag to bincio render to backfill existing activities.
This commit is contained in:
@@ -422,6 +422,11 @@ def _elevation(
|
||||
gain = loss = 0.0
|
||||
committed = elevations[start]
|
||||
for e in elevations[start + 1:]:
|
||||
# Skip near-zero values that appear mid-recording while we are at a
|
||||
# significant elevation — these are sensor dropouts (device lost GPS/
|
||||
# barometric lock), not genuine sea-level crossings.
|
||||
if abs(e) < 1.0 and abs(committed) > threshold:
|
||||
continue
|
||||
diff = e - committed
|
||||
if abs(diff) >= threshold:
|
||||
if diff > 0:
|
||||
|
||||
Reference in New Issue
Block a user