Skip to content

Commit

Permalink
Ensure lat and lon are case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-developer committed Aug 9, 2024
1 parent 3c01353 commit 540eff3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/modules/allsky_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,7 @@ def _convertLatLon(self, input):
""" lat and lon can either be a positive or negative float, or end with N, S, E,or W. """
""" If in N, S, E, W format, 0.2E becomes -0.2 """
nsew = False
input = input.upper()
if isinstance(input, str):
nsew = 1 if input[-1] in ['N', 'S', 'E', 'W'] else 0
if nsew:
Expand Down
2 changes: 2 additions & 0 deletions scripts/modules/allsky_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ def setLastRun(module):

def convertLatLonOld(input):
""" Converts the lat and lon to decimal notation i.e. 0.2E becomes -0.2"""
input = input.upper()
multiplier = 1 if input[-1] in ['N', 'E'] else -1
return multiplier * sum(float(x) / 60 ** n for n, x in enumerate(input[:-1].split('-')))

def convertLatLon(input):
""" lat and lon can either be a positive or negative float, or end with N, S, E,or W. """
""" If in N, S, E, W format, 0.2E becomes -0.2 """
input = input.upper()
nsew = 1 if input[-1] in ['N', 'S', 'E', 'W'] else 0
if nsew:
multiplier = 1 if input[-1] in ['N', 'E'] else -1
Expand Down

0 comments on commit 540eff3

Please sign in to comment.