Skip to content

Commit

Permalink
fixed dms2dec
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibiko committed Nov 11, 2024
1 parent 8f2bd73 commit a395e92
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pyamsd/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ def dms2dec(c):
a = float(c)
return a
except ValueError:
deg, min, sec, dir = re.split('[°\'"]', c)
deg, min, sec, dir = re.split(r'[°\'"]\s*', c.strip())
if dir == '':
if deg.startswith('-'):
dir = 'w'
deg = deg[1:]
return round(
(float(deg) + float(min) / 60 + float(sec) / 3600) * (
-1 if dir.strip().lower() in ['w', 's'] else 1), 6)

0 comments on commit a395e92

Please sign in to comment.