From c0e8fe1bb4413d6744ecbbf1d7ea85e541c42cd4 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Thu, 19 Sep 2019 08:00:11 +1000 Subject: [PATCH] Add units to file info --- daqviewer/daqviewer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daqviewer/daqviewer.py b/daqviewer/daqviewer.py index 5fd9dc7..a2b4b70 100644 --- a/daqviewer/daqviewer.py +++ b/daqviewer/daqviewer.py @@ -50,6 +50,7 @@ def parse_contents(contents, filename): # Check instrument type inst_type = basename.split('_')[-1] + units = pd.read_csv(io.StringIO(decoded.decode('utf-8'))).columns[1] if inst_type == 'WP': df = pd.read_csv(io.StringIO(decoded.decode('utf-8')), index_col=0, @@ -103,7 +104,7 @@ def parse_contents(contents, filename): # Add spectral values to dataframe stats.loc[col, keys] = values - info = {'filename': filename, 'instrument type': inst_type} + info = {'filename': filename, 'instrument type': inst_type, 'units': units} json_data = {} json_data['info'] = info json_data['timeseries'] = df.to_json(orient='table')