Skip to content

Instantly share code, notes, and snippets.

@jkinred
Last active December 31, 2015 09:09
Show Gist options
  • Save jkinred/7964830 to your computer and use it in GitHub Desktop.
Save jkinred/7964830 to your computer and use it in GitHub Desktop.
Code used to combine a Compeo+ and 76s tracklog.
#!/usr/bin/env python
import datetime
from igc2kmz.igc import IGC
garmin = IGC(open('blackheath_blackville_garmin.igc'))
compeo = IGC(open('blackheath_blackville_compeo.igc'))
g_track = garmin.track()
c_track = compeo.track()
for i,t1 in enumerate(c_track.t):
for j,t2 in enumerate(g_track.t):
if t2 >= t1-3 and t2 <= t1+3:
dt = datetime.datetime.fromtimestamp(c_track.t[i])
# HHMMSS LAT LONG 'A' 00000 00ALT
print('B%02d%02d%02d%sS%sEA00000%05d' % (dt.hour, dt.minute, dt.second, garmin.o[j]['lat'], garmin.o[j]['lon'], c_track.ele[i]))
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment