Update public source
This commit is contained in:
@@ -6,6 +6,7 @@ from collections import defaultdict
|
||||
from reports.database import query_all, query_one
|
||||
from reports.utils import (
|
||||
format_datetime as format_report_datetime,
|
||||
haversine_m,
|
||||
)
|
||||
|
||||
from reports.template import (
|
||||
@@ -52,24 +53,6 @@ def format_speed(value):
|
||||
return f"{speed:.1f}"
|
||||
|
||||
|
||||
def haversine_m(lat1, lon1, lat2, lon2):
|
||||
radius = 6371000.0
|
||||
|
||||
phi1 = math.radians(lat1)
|
||||
phi2 = math.radians(lat2)
|
||||
dphi = math.radians(lat2 - lat1)
|
||||
dlambda = math.radians(lon2 - lon1)
|
||||
|
||||
a = (
|
||||
math.sin(dphi / 2.0) ** 2
|
||||
+ math.cos(phi1)
|
||||
* math.cos(phi2)
|
||||
* math.sin(dlambda / 2.0) ** 2
|
||||
)
|
||||
|
||||
return 2.0 * radius * math.asin(min(1.0, math.sqrt(a)))
|
||||
|
||||
|
||||
def weighted_mean(values):
|
||||
if not values:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user