From 8cd26d0e4ce7a642bdfac8bb1f4f8ab41b54bc65 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Tue, 3 Sep 2019 08:22:08 +1000 Subject: [PATCH] Don't check if file is valid --- daqviewer/daqviewer.py | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/daqviewer/daqviewer.py b/daqviewer/daqviewer.py index 9f3442c..16002a9 100644 --- a/daqviewer/daqviewer.py +++ b/daqviewer/daqviewer.py @@ -50,29 +50,25 @@ def parse_contents(contents, filename): # Check instrument type inst_type = basename.split('_')[-1] - try: - if inst_type == 'WP': - df = pd.read_csv(io.StringIO(decoded.decode('utf-8')), - index_col=0, - header=5, - skiprows=[6]) - - # Rename columns based on probe locations - suffixes = ['P1', 'P2', 'P3', 'incident', 'reflected'] - col_names = list(df.columns) - for i, col in enumerate(col_names[:-4]): - if ('.' not in col) and (col_names[i + 4] == col + '.4'): - for j, suffix in enumerate(suffixes): - col_names[i + j] = '{}-{}'.format(col, suffix) - df.columns = col_names - else: - df = pd.read_csv(io.StringIO(decoded.decode('utf-8')), - index_col=0, - header=3, - skiprows=[4]) - - except Exception as e: - return html.Div(['There was an error processing this file.']) + if inst_type == 'WP': + df = pd.read_csv(io.StringIO(decoded.decode('utf-8')), + index_col=0, + header=5, + skiprows=[6]) + + # Rename columns based on probe locations + suffixes = ['P1', 'P2', 'P3', 'incident', 'reflected'] + col_names = list(df.columns) + for i, col in enumerate(col_names[:-4]): + if ('.' not in col) and (col_names[i + 4] == col + '.4'): + for j, suffix in enumerate(suffixes): + col_names[i + j] = '{}-{}'.format(col, suffix) + df.columns = col_names + else: + df = pd.read_csv(io.StringIO(decoded.decode('utf-8')), + index_col=0, + header=3, + skiprows=[4]) # Zero time series based on first 5s df -= df[:5].mean()