feat(gpx): apply elevation cleaning to totals + profile chart
Task group 2 (part a) of elevation-profile-hardening — wire the group-1 primitives into the headline stat and the chart. - computeElevation (parse.ts): despike each segment's elevation sequence, then take filteredTotals; gain/loss are now noise-filtered (no more 20–50% inflation from per-point jitter), the profile is built from the despiked data, and additive gainRaw/lossRaw expose the unfiltered sums. - elevationSeries: despike per segment (no cross-trkseg interpolation) before downsampling, so the chart and the headline totals derive from the same cleaned data. - types.ts: GpxData.elevation gains gainRaw/lossRaw (additive). Well-formed monotonic climbs are unchanged (steps exceed the 5 m threshold → filtered == raw); a shared noisy-track test proves jitter is filtered and a 300 m single-point spike is interpolated out of both the totals and the chart. Verified: gpx 111/111; full pnpm typecheck 13/13, lint 13/13, test 11/11 (journal + planner compile with the additive fields). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
79124620d3
commit
29be9cbe5f
6 changed files with 114 additions and 28 deletions
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
## 2. Wire into existing computations
|
||||
|
||||
- [ ] 2.1 Update `computeElevation` in `packages/gpx/src/parse.ts` to despike per segment, then use `filteredTotals`; keep `gain`/`loss`/`profile` shape and expose `gainRaw`/`lossRaw` as additional fields (profile built from despiked data)
|
||||
- [ ] 2.2 Update `elevationSeries` in `packages/gpx/src/elevation-series.ts` to build from despiked points (despike per segment before flattening)
|
||||
- [x] 2.1 Update `computeElevation` in `packages/gpx/src/parse.ts` to despike per segment, then use `filteredTotals`; keep `gain`/`loss`/`profile` shape and expose `gainRaw`/`lossRaw` as additional fields (profile built from despiked data)
|
||||
- [x] 2.2 Update `elevationSeries` in `packages/gpx/src/elevation-series.ts` to build from despiked points (despike per segment before flattening)
|
||||
- [ ] 2.3 Update `compute-days.ts` to build its cumulative ascent/descent arrays via `cumulativeFilteredTotals` over the despiked track
|
||||
- [ ] 2.4 Update/extend existing tests (`parse.test.ts`, `elevation-series.test.ts`, `compute-days.test.ts`) with a shared noisy-track fixture; assert chart series, totals, and day sums agree
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue