import datetime
import json

f = "/data/Webserver/currentprojects/NORSE/data/NORSE_Rover.txt"

lines = open(f,'r').readlines()

pos = {'time':[],'lat':[],'lon':[]}

for line in lines[2:]:
  d = line.split()
  time = datetime.datetime(int(d[0]),int(d[1]),int(d[2]),int(d[3]),int(d[4]),0)
  lat = float(d[5])
  lon = float(d[6])

  if d[11] == '0123150':
    pos['time'].append( time.strftime('%Y-%m-%dT%H:%M:%SZ') )
    pos['lat'].append( lat )
    pos['lon'].append( lon )

json.dump(pos,open('/data/Webserver/currentprojects/NORSE/data/DBASIS1.json','w'))
