Skip to content
Snippets Groups Projects
Commit d64fba0e authored by Coda Phillips's avatar Coda Phillips
Browse files

Ignore errors with differing file lengths in vis app

parent 64de2fa5
No related branches found
No related tags found
No related merge requests found
...@@ -51,16 +51,20 @@ def ignore_error(func, error): ...@@ -51,16 +51,20 @@ def ignore_error(func, error):
def plot_check(nc, check, sum_hk): def plot_check(nc, check, sum_hk):
check_var = nc.variables[check] check_var = nc.variables[check]
passes_qc = check_var[:] < .95 passes_qc = check_var[:] < .95
assert len(passes_qc) == len(sum_hk) if len(passes_qc) != len(sum_hk):
print("len(passes_qc) = {}\nlen(sum_hk) = {}".format(len(passes_qc), len(sum_hk)))
len_shortest = min(len(passes_qc),len(sum_hk))
passes_qc = passes_qc[:len_shortest]
for depend in check_var.depends.split(','): for depend in check_var.depends.split(','):
if depend in sum_hk.columns: if depend in sum_hk.columns:
fig = plt.figure() fig = plt.figure()
# Passing check and qc_percent # Passing check and qc_percent
ignore_error(lambda : sum_hk[depend].ix[(nc.variables['qc_percent'][:] < .95) & passes_qc].plot(style='b.'), TypeError) ignore_error(lambda : sum_hk[depend].iloc[:len_shortest].ix[(nc.variables['qc_percent'][:len_shortest] < .95) & passes_qc].plot(style='b.'), TypeError)
# Passing check but fails overall # Passing check but fails overall
ignore_error(lambda : sum_hk[depend].ix[(nc.variables['qc_percent'][:] > .95) & passes_qc].plot(style='k.',alpha=.2), TypeError) ignore_error(lambda : sum_hk[depend].iloc[:len_shortest].ix[(nc.variables['qc_percent'][:len_shortest] > .95) & passes_qc].plot(style='k.',alpha=.2), TypeError)
# Failing check and implicitly failing overall # Failing check and implicitly failing overall
ignore_error(lambda : sum_hk[depend].ix[~passes_qc].plot(style='r.'), TypeError) ignore_error(lambda : sum_hk[depend].iloc[:len_shortest].ix[~passes_qc].plot(style='r.'), TypeError)
plt.xlabel('Record') plt.xlabel('Record')
plt.title(depend) plt.title(depend)
yield mpld3.fig_to_html(fig) yield mpld3.fig_to_html(fig)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment