improve sql readability
@@ -148,15 +148,26 @@ def great_circle_distance_km_sql(lat_l, lat_r, long_l, long_r):
partial_distance_sql = f"""
(
- pow(sin(radians({lat_r} - {lat_l}))/2, 2) +
+ pow(
+ sin( radians({lat_r} - {lat_l}) ) / 2,
+ 2
+ ) +
cos( radians({lat_l}) ) * cos( radians({lat_r} )) *
- pow(sin(radians({long_r} - {long_l})/2),2)
+ pow(
+ sin( radians({long_r} - {long_l}) / 2 ),
+ 2
+ )
)
"""
distance_km_sql = f"""
- cast(atan2(sqrt({partial_distance_sql}),
- sqrt(-1*{partial_distance_sql} + 1)) * {EARTH_DIAMETER_KM} as float)
+ cast(
+ atan2(
+ sqrt({partial_distance_sql}),
+ sqrt(-1*{partial_distance_sql} + 1)
+ ) * {EARTH_DIAMETER_KM}
+ as float
+ )
"""
return distance_km_sql
