Skip to content

Commit

Permalink
run autopep8
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeniau committed Jul 15, 2022
1 parent 184d337 commit d4b3cdf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions haversine/haversine.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ def haversine_vector(array1, array2, unit=Unit.KILOMETERS, comb=False, normalize
# Asserts that both arrays have same dimensions if not in combination mode
if not comb:
if array1.shape != array2.shape:
raise IndexError("When not in combination mode, arrays must be of same size. If mode is required, use comb=True as argument.")
raise IndexError(
"When not in combination mode, arrays must be of same size. If mode is required, use comb=True as argument.")

# normalize points or ensure they are proper lat/lon, i.e., in [-90, 90] and [-180, 180]
if normalize:
Expand Down Expand Up @@ -206,8 +207,10 @@ def inverse_haversine(point, distance, direction: Union[Direction, float], unit=
r = get_avg_earth_radius(unit)
brng = direction.value if isinstance(direction, Direction) else direction

return_lat = asin(sin(lat) * cos(d / r) + cos(lat) * sin(d / r) * cos(brng))
return_lng = lng + atan2(sin(brng) * sin(d / r) * cos(lat), cos(d / r) - sin(lat) * sin(return_lat))
return_lat = asin(sin(lat) * cos(d / r) + cos(lat)
* sin(d / r) * cos(brng))
return_lng = lng + atan2(sin(brng) * sin(d / r) *
cos(lat), cos(d / r) - sin(lat) * sin(return_lat))

return_lat, return_lng = map(degrees, (return_lat, return_lng))
return return_lat, return_lng

0 comments on commit d4b3cdf

Please sign in to comment.