Package sabx10 :: Package map :: Module elevations
[hide private]
[frames] | no frames]

Module elevations

source code

Process elevation data for an SABX ride.

Classes [hide private]
  PointsProcessor
Encapsulates a set of points representing a line and all the operations we might want to do on it.
  SegmentProcessor
Hold all the values we are interested in for a ride segment and create a dictionary to present them.
  SegmentAccumulator
Gather all the values we're interested in for a ride by extracting them from the processed segments and accumulating them.
Functions [hide private]
list
_filter_climbs(climbs, count)
Takes a raw list of climbs, filters out climbs that are only downhill, then sorts by length and returns the top "count" climbs.
source code
(float,float)
_calc_rise_fall_grades(rise_height, rise_dist, fall_height, fall_dist)
Calculate the rising and falling grades for a set of data.
source code
dict, list of dict
process_elevations(ride)
This is the main entry point for this module.
source code
Variables [hide private]
  __package__ = 'sabx10.map'
Function Details [hide private]

_filter_climbs(climbs, count)

source code 

Takes a raw list of climbs, filters out climbs that are only downhill, then sorts by length and returns the top "count" climbs. The returned list is sorted by steepness. Each climb in the list is a tuple of (grade,length).

Parameters:
  • climbs (list) - list of climbs to process
  • count (int) - how many climbs to return
Returns: list
top 'count' climbs

_calc_rise_fall_grades(rise_height, rise_dist, fall_height, fall_dist)

source code 

Calculate the rising and falling grades for a set of data.

Parameters:
  • rise_height (float) - rising height
  • rise_dist (float) - rising distance
  • fall_height (float) - falling height
  • fall_dist (float) - falling distance
Returns: (float,float)
rising grade, falling grade

process_elevations(ride)

source code 

This is the main entry point for this module. It goes through the elevation data for a ride and creates lists of processed data. It returns the data as a single dictionary describing the overall ride and a list of dictionaries that each describe a segment of the ride.

Each dictionary element in the segment list has the following information:

  • id: id of segment
  • start_dist: distance in ride for starting point
  • end_dist: distance in ride for ending point
  • length: length of ride
  • net_height: net change in elevation over segment
  • rise_height: height of climbing in segment
  • rise_dist: distance spent climbing in segment
  • rise_grade: average grade of climbing in segment
  • fall_height: height of descending in segment
  • fall_dist: distance spent descending in segment
  • fall_grade: average grade of descending in segment
  • climbs: list with climbs, their grades, and their lengths in segment

The overall ride data is a dictionary with the following data:

  • length: length of ride
  • net_height: net change in elevation over ride
  • rise_height: height of climbing in ride
  • rise_dist: distance spent climbing in ride
  • rise_grade: average grade of climbing in ride
  • fall_height: height of descending in ride
  • fall_dist: distance spent descending in ride
  • fall_grade: average grade of descending in ride
  • climbs: list with climbs, their grades, and their lengths in ride
Parameters:
  • ride (Ride) - ride to process
Returns: dict, list of dict
ride data, list of segment data