fietsboek.transformers.elevation module¶
Transformers that deal with elevation changes in the track.
- class fietsboek.transformers.elevation.FixElevationJumps¶
Bases:
TransformerA transformer that fixes big jumps in the elevation.
- classmethod description()¶
A short description of what this transformer does.
- Return type:
TranslationString- Returns:
The transformer’s description.
- classmethod enabled_by_default()¶
Whether this transformer should be enabled by default.
- Return type:
- execute(path)¶
Run the transformation on the input gpx.
This is expected to modify the path to represent the new state.
- Parameters:
path (
Path) – The path to transform. Note that this object will be mutated!
- classmethod identifier()¶
Returns a string identifier for this transformer.
This identifier is used when serializing/deserializing the filters.
- Return type:
- Returns:
A machine-readable identifier for this transformer.
- classmethod name()¶
The human-readable name of this transformer, as a translateable string.
- Return type:
TranslationString- Returns:
The transformer’s name.
- classmethod parameter_model()¶
Returns the parameter model that this transformer expects.
- Return type:
- Returns:
The parameter model class.
- property parameters: Parameters¶
Returns the parameters of this transformer.
Note that the caller may modify the parameters, which should be reflected in future applications of the transformer.
- Returns:
The parameters.
- class fietsboek.transformers.elevation.FixNullElevation¶
Bases:
TransformerA transformer that fixes points with zero elevation.
- classmethod description()¶
A short description of what this transformer does.
- Return type:
TranslationString- Returns:
The transformer’s description.
- classmethod enabled_by_default()¶
Whether this transformer should be enabled by default.
- Return type:
- execute(path)¶
Run the transformation on the input gpx.
This is expected to modify the path to represent the new state.
- Parameters:
path (
Path) – The path to transform. Note that this object will be mutated!
- classmethod fixup(points)¶
Fixes the given GPX points.
This iterates over the points and checks for the first point that has a non-zero elevation, and a slope that doesn’t exceed 100%. All previous points will have their elevation adjusted to match this first “good point”.
- classmethod identifier()¶
Returns a string identifier for this transformer.
This identifier is used when serializing/deserializing the filters.
- Return type:
- Returns:
A machine-readable identifier for this transformer.
- classmethod name()¶
The human-readable name of this transformer, as a translateable string.
- Return type:
TranslationString- Returns:
The transformer’s name.
- classmethod parameter_model()¶
Returns the parameter model that this transformer expects.
- Return type:
- Returns:
The parameter model class.
- property parameters: Parameters¶
Returns the parameters of this transformer.
Note that the caller may modify the parameters, which should be reflected in future applications of the transformer.
- Returns:
The parameters.
- class fietsboek.transformers.elevation.SmoothElevation¶
Bases:
TransformerA transformer that smooths the elevation.
Technical description:
This transformer has the goal of smoothing out noise in the GPS elevation recording, while keeping the overall elevation profile true to the original. We do this in two parts: First, we estimate the noisiness of the input data. Then we apply a Savitzky-Golay filter, whose strength is scaled by the noisiness estimated in the first step.
Step 1: Noise estimation
To estimate the noisiness, we walk through the file in windows of 5 points. We do a linear regression through those points, and compute the sum of absolute errors.
The reason behind this is that we assume that the profile given by 5 points can be approximated reasonably with a straight line, so deviations from this line are likely caused by noise in the recording.
We average the sum-of-errors over all windows in the track to reach the track’s total noisiness, this prevents outlier windows from affecting the noisiness too much.
Step 2: Filter
The actual smoothing is done with a pass of the Savitzky-Golay filter. The window size \(w\) is scaled linearly according to the noisiness \(w\) determined in step 1 as \(w = n \cdot f\). The factor \(f\) is fixed and determined manually with some example tracks.
- classmethod description()¶
A short description of what this transformer does.
- Return type:
TranslationString- Returns:
The transformer’s description.
- classmethod enabled_by_default()¶
Whether this transformer should be enabled by default.
- Return type:
- execute(path)¶
Run the transformation on the input gpx.
This is expected to modify the path to represent the new state.
- Parameters:
path (
Path) – The path to transform. Note that this object will be mutated!
- classmethod identifier()¶
Returns a string identifier for this transformer.
This identifier is used when serializing/deserializing the filters.
- Return type:
- Returns:
A machine-readable identifier for this transformer.
- classmethod name()¶
The human-readable name of this transformer, as a translateable string.
- Return type:
TranslationString- Returns:
The transformer’s name.
- classmethod parameter_model()¶
Returns the parameter model that this transformer expects.
- Return type:
- Returns:
The parameter model class.
- property parameters: Parameters¶
Returns the parameters of this transformer.
Note that the caller may modify the parameters, which should be reflected in future applications of the transformer.
- Returns:
The parameters.