Normalise longitude range for tawhiri predictions

pull/28/head
David Brooke 2021-01-27 12:19:25 +00:00
rodzic ce48b7b017
commit c1fab8bdad
1 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -40,6 +40,10 @@ def get_tawhiri_prediction(
# Create RFC3339-compliant timestamp
_dt_rfc3339 = launch_datetime.isoformat()
# Normalise longitude to range 0 to 360
if launch_longitude < 0:
launch_longitude += 360
_params = {
"launch_latitude": launch_latitude,
"launch_longitude": launch_longitude,
@ -93,6 +97,10 @@ def parse_tawhiri_data(data):
for _point in _trajectory:
# Normalise longitude to range -180 to 180
if _point["longitude"] > 180:
_point["longitude"] -= 360
# Create UTC timestamp without using datetime.timestamp(), for Python 2.7 backwards compatibility.
_dt = parse(_point["datetime"])
_dt_timestamp = (_dt - _epoch).total_seconds()