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()