Commit 7737986b authored by enfo's avatar enfo

Added ENU to mats by rtklib2matlab.py

parent 6c379ec9
......@@ -52,6 +52,7 @@ if __name__ == '__main__':
'sdz', 'sdxy', 'sdyz', 'sdzx', 'age', 'ratio']
n_lines = 0
ref_pos = None
with open(infile, 'rU') as f:
for line in f:
if line.startswith('%'):
......@@ -69,6 +70,9 @@ if __name__ == '__main__':
names = [handle_name(name) for name in split_line(line.strip('% '))]
if names[0] == 'gpst':
names.insert(0, 'week')
if 'ref pos' in line:
data_start = line.index(':', 1)
ref_pos = [float(p) for p in split_line(line[data_start+1:].strip())]
continue
data_line = parseline(line, names)
for key, val in data_line.items():
......@@ -79,6 +83,17 @@ if __name__ == '__main__':
data[key][c_line] = val
c_line += 1
if 'latitude' in names:
try:
from pymap3d import geodetic2enu
print('Adding enu')
east, north, up = geodetic2enu(data['latitude'], data['longitude'], data['height'], *ref_pos)
data['e_baseline'] = east
data['n_baseline'] = north
data['u_baseline'] = up
except ImportError:
print('Install pymap3d to automatically add enu solution')
print('Saving .mat')
savemat(outfile, {'rtklib': data})
print('Done.')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment