Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update geo.py #250

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions gpxpy/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def length_3d(locations: List["Location"]=[]) -> float:
return length(locations, True)


def calculate_max_speed(speeds_and_distances: List[Tuple[float, float]], extreemes_percentile: float, ignore_nonstandard_distances: bool) -> Optional[float]:
def calculate_max_speed(speeds_and_distances: List[Tuple[float, float]], extremes_percentile: float, ignore_nonstandard_distances: bool) -> Optional[float]:
"""
Compute average distance and standard deviation for distance. Extremes
in distances are usually extremes in speeds, so we will ignore them,
Expand Down Expand Up @@ -157,7 +157,7 @@ def calculate_max_speed(speeds_and_distances: List[Tuple[float, float]], extreem
speeds.sort()

# Even here there may be some extremes => ignore the last 5%:
index = int(len(speeds) * (1-extreemes_percentile))
index = int(len(speeds) * (1-extremes_percentile))
if index >= len(speeds):
index = -1

Expand Down Expand Up @@ -235,11 +235,8 @@ def elevation_angle(location1: "Location", location2: "Location", radians: float
return 0

angle = mod_math.atan(b / a)

if radians:
return angle

return mod_math.degrees(angle)

return angle if radians else mod_math.degrees(angle)


def distance_from_line(point: "Location", line_point_1: "Location", line_point_2: "Location") -> Optional[float]:
Expand Down