Don't check if file is valid

master
Dan Howe 5 years ago
parent c0024c0abd
commit 8cd26d0e4c

@ -50,29 +50,25 @@ def parse_contents(contents, filename):
# Check instrument type # Check instrument type
inst_type = basename.split('_')[-1] inst_type = basename.split('_')[-1]
try: if inst_type == 'WP':
if inst_type == 'WP': df = pd.read_csv(io.StringIO(decoded.decode('utf-8')),
df = pd.read_csv(io.StringIO(decoded.decode('utf-8')), index_col=0,
index_col=0, header=5,
header=5, skiprows=[6])
skiprows=[6])
# Rename columns based on probe locations
# Rename columns based on probe locations suffixes = ['P1', 'P2', 'P3', 'incident', 'reflected']
suffixes = ['P1', 'P2', 'P3', 'incident', 'reflected'] col_names = list(df.columns)
col_names = list(df.columns) for i, col in enumerate(col_names[:-4]):
for i, col in enumerate(col_names[:-4]): if ('.' not in col) and (col_names[i + 4] == col + '.4'):
if ('.' not in col) and (col_names[i + 4] == col + '.4'): for j, suffix in enumerate(suffixes):
for j, suffix in enumerate(suffixes): col_names[i + j] = '{}-{}'.format(col, suffix)
col_names[i + j] = '{}-{}'.format(col, suffix) df.columns = col_names
df.columns = col_names else:
else: df = pd.read_csv(io.StringIO(decoded.decode('utf-8')),
df = pd.read_csv(io.StringIO(decoded.decode('utf-8')), index_col=0,
index_col=0, header=3,
header=3, skiprows=[4])
skiprows=[4])
except Exception as e:
return html.Div(['There was an error processing this file.'])
# Zero time series based on first 5s # Zero time series based on first 5s
df -= df[:5].mean() df -= df[:5].mean()

Loading…
Cancel
Save