diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-09-24 08:37:33 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-09-24 08:37:33 +0200 |
| commit | 90614736f2a0c556f31eca5361b3c032f5f309f6 (patch) | |
| tree | 81fda954dc2bff8ae8b0023b502343c455995272 /web/climbs.go | |
| parent | e3d0beee5be3dd2854b0f4fc10905a4fcdc08f47 (diff) | |
Match official climbs against their recorded sample
An official climb matched on endpoint coordinates alone. On a loop ridden
the other way the route meets the climb's top before its bottom, so pairing
each start with the first end inside its lap window credited a 5.9 km
passage as the 850 m Chemin de la Tour Pey Blanc, and a 49 km one on
another ride.
Climbs now keep the sample of the segment they were created from: the
recorded length and elevation gain of the selected route points, captured
by the ride detail and preview handlers and stored NOT NULL. Matching takes
the whole route and drops any candidate outside ±50% of that sample on
either axis, and attempts are refreshed by upsert and prune so re-analyzing
a ride keeps the recorded-at stamp of the passages that survive.
The backfill leaves the web package: backfill.Run recomputes ride values
then official climb attempts as a single `go run . backfill` command
(climbs-backfill is gone), rideanalysis owns the attempt snapshot, and the
mountain-pass loading margin is shared. Applied to the stored rides it
stamps 78 samples, drops the four bogus attempts and leaves ride 800 with
its three Pont Rout passages.
Diffstat (limited to 'web/climbs.go')
| -rw-r--r-- | web/climbs.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/web/climbs.go b/web/climbs.go index 6859545..6416509 100644 --- a/web/climbs.go +++ b/web/climbs.go @@ -101,9 +101,7 @@ func (s *Server) handleClimb(w http.ResponseWriter, r *http.Request) { }), w) } -// buildClimbProfile computes the median normalized elevation profile from the -// linked rides: each ride is parsed, its climb occurrences matched, and every -// occurrence resampled onto the shared normalized axis. +// buildClimbProfile computes the median normalized elevation profile from the linked rides, resampling every occurrence onto a shared axis. func (s *Server) buildClimbProfile(officialClimb official_climb.OfficialClimb, aggregate official_climb.Aggregate, attempts []official_climb.Attempt) ClimbProfileData { profile := ClimbProfileData{DistanceKm: aggregate.DistanceM / 1000} if len(attempts) == 0 { @@ -127,7 +125,7 @@ func (s *Server) buildClimbProfile(officialClimb official_climb.OfficialClimb, a slog.Warn("Failed to parse ride for climb profile", "climb_id", officialClimb.ID, "ride_id", attempt.RideID, "error", err) continue } - for _, matched := range official_climb.MatchClimbs(parsed.Coords, officialClimb, matchPolicy.EndpointRadiusM) { + for _, matched := range official_climb.MatchClimbs(parsed.Route, officialClimb, matchPolicy.EndpointRadiusM) { segment := climb.Climb{Route: climb.Route{ Distances: parsed.Distances[matched.StartIndex : matched.EndIndex+1], Elevations: parsed.Elevations[matched.StartIndex : matched.EndIndex+1], @@ -152,9 +150,7 @@ func (s *Server) buildClimbProfile(officialClimb official_climb.OfficialClimb, a return profile } -// medianRoute picks the recorded route of the attempt whose distance is the -// median across occurrences: full recorded precision, no resampling, and -// robust to one GPS-drifted ride. +// medianRoute picks the recorded route of the attempt whose distance is the median: full precision, no resampling, robust to one drifted ride. func medianRoute(candidates []routeCandidate) []geodist.Coord { if len(candidates) == 0 { return nil |
