2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-08 07:28:45 +00:00

cope with zero lat long

This commit is contained in:
2026-02-04 20:18:14 +00:00
parent 8204a40667
commit e7ecae6295
2 changed files with 10 additions and 10 deletions

View File

@@ -148,12 +148,15 @@ def extract_gps(dict):
def extract(gpsifd):
if item:=is_present(gpsifd): # walrus
n, d = item
return n/d
if d:
return n/d
return None
def rational(tup):
nom, denom = tup
return nom/denom
if denom:
return nom/denom
return None
def rationalise(item):
df, mf, sf = item
@@ -195,7 +198,10 @@ def extract_gps(dict):
if item := is_present("GPSTimeStamp"):
h, m, s = rationalise(item)
timestamp_utc = f"{ds} {h:02.0f}:{m:02.0f}:{s:02.0f} +00:00 UTC"
if h and m and s:
timestamp_utc = f"{ds} {h:02.0f}:{m:02.0f}:{s:02.0f} +00:00 UTC"
else:
timestamp_utc = f"{ds}"
else:
timestamp_utc = f"{ds}"