Skip to content

Commit

Permalink
csv converter for trace jsons
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf committed Feb 2, 2020
1 parent 77fbe6c commit e6b83f2
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions toCSV.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python3

import sys, json


with open(sys.argv[1]) as jsonFile:
data = json.load(jsonFile)

timeZero = data['timestamp']
trace = data['trace']

for i in trace:
state = i
ts = timeZero + state[0]
lat = state[1]
lon = state[2]
alt = state[3]
gs = state[4]
track = state[5]
stale = state[6]

outString = str(ts)
outString += ',' + str(lat)
outString += ',' + str(lon)
outString += ',' + str(alt)
outString += ',' + str(gs)
outString += ',' + str(track)

print(outString)

0 comments on commit e6b83f2

Please sign in to comment.