Commit 304a94ba authored by enfo's avatar enfo

Added support for rtklib2avg min_sat

parent 5f55af0d
......@@ -33,13 +33,18 @@ if __name__ == '__main__':
print('')
print_usage()
if len(sys.argv) == 3:
if len(sys.argv) >= 3:
min_quality = int(sys.argv[2])
else:
min_quality = 1
if len(sys.argv) >= 4:
min_sat = int(sys.argv[3])
else:
min_sat = 6
infile = sys.argv[1]
print('Extracting average from %s with Q <= %d' % (infile, min_quality))
print('Extracting average from %s with Q <= %d, n_sat >= %d' % (infile, min_quality, min_sat))
names = ['week', 'tow', 'ecef_x', 'ecef_y', 'ecef_z', 'Q', 'ns', 'sdx', 'sdy',
'sdz', 'sdxy', 'sdyz', 'sdzx', 'age', 'ratio']
......@@ -55,21 +60,23 @@ if __name__ == '__main__':
n_lines += 1
f.seek(0)
arr = np.zeros((4, n_lines))
arr = np.zeros((5, n_lines))
arr_ix=0
for line in f:
if line.startswith('%'):
continue
data_line = parseline(line, names)
for key, val in data_line.items():
if key in ['x_ecef', 'lat']:
if key in ['x_ecef', 'lat', 'latitude']:
arr[0, arr_ix] = val
elif key in ['y_ecef', 'lon']:
elif key in ['y_ecef', 'lon', 'longitude']:
arr[1, arr_ix] = val
elif key in ['z_ecef', 'alt']:
elif key in ['z_ecef', 'alt', 'height']:
arr[2, arr_ix] = val
elif key == 'q':
arr[3, arr_ix] = val
elif key == 'ns':
arr[4, arr_ix] = val
arr_ix += 1
print('')
......@@ -77,8 +84,16 @@ if __name__ == '__main__':
legal_arr = arr[:, arr[3,:] > 0]
valid_arr = legal_arr[:, legal_arr[3,:] <= min_quality]
valid_arr = valid_arr[:, valid_arr[4,:] >= min_sat]
print('Found %d quality points.' % valid_arr.shape[1])
for ix, key in enumerate(names):
if key in ['x_ecef', 'lat', 'latitude']:
name_start_ix = ix
break
print('')
print('Mean: %s' % np.mean(valid_arr, axis=1)[:3])
print('Mean:')
print('\t'.join(names[name_start_ix:name_start_ix+3]))
llh = np.mean(valid_arr, axis=1)[:3]
print('%.12f\t%.12f\t%.12f' % (llh[0], llh[1], llh[2]))
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