diff options
Diffstat (limited to 'iss/utils.py')
| -rw-r--r-- | iss/utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/iss/utils.py b/iss/utils.py index 326d835..656d4e3 100644 --- a/iss/utils.py +++ b/iss/utils.py @@ -7,6 +7,14 @@ def seconds_to_minutes(secs): return f"{secs // 60}:{secs % 60:02}" +def normalize_lat_lng(lat, lng): + if lat[0] not in "NS" or lng[0] not in "EW": + raise Exception("Lat/lng must be formatted as N12.345 and E67.890") + nlat = float(lat[1:]) * (-1 if lat[0] == "S" else 1) + nlng = float(lng[1:]) * (-1 if lng[0] == "W" else 1) + return nlat, nlng + + def deg_to_cardinal(deg): cardinals = [ "N", |
