Fix parsing of parameter text

master
Dan Howe 5 years ago
parent 3a0562dbf4
commit 04431994b7

@ -80,11 +80,11 @@ meas = tree.get_element_by_id(f'MainContent_ctl{stn_id:02}_lblSummary')
description = tree.get_element_by_id(f'MainContent_ctl{stn_id:02}_lblTitle') description = tree.get_element_by_id(f'MainContent_ctl{stn_id:02}_lblTitle')
# Parse column names # Parse column names
text = re.split(':', meas.text) text = re.split(':\s|(m|s|knots|deg)\s', meas.text + ' ')
parameters = text[::3] parts = [t for t in text if t]
entries = [re.split('(\D+)$', t) for t in text[1::3]] parameters = [p.strip() for p in parts[::3]]
values = [float(e[0]) for e in entries] values = [float(p) for p in parts[1::3]]
units = [e[1] for e in entries] units = parts[2::3]
columns = [f'{p} ({u})' for p, u in zip(parameters, units)] columns = [f'{p} ({u})' for p, u in zip(parameters, units)]
# Parse time # Parse time

Loading…
Cancel
Save