From 1d2c9378bec6411ec0c8540fea1ff12ae23fcbe7 Mon Sep 17 00:00:00 2001 From: Coda Phillips <cphillips@sean.ssec.wisc.edu> Date: Wed, 27 Jul 2016 11:51:57 -0500 Subject: [PATCH] Handle the case where all records get marked --- util.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/util.py b/util.py index 136a619..14a2ada 100644 --- a/util.py +++ b/util.py @@ -36,8 +36,9 @@ def update_variable_qc(frame, variable_qcs): return frame.drop('qc_notes', axis=1).combine(variable_qcs, proba_update, fill_value=0).combine_first(frame[['qc_notes']]) def annotate_all(frame, mask, annotation): - for loc in frame.index[mask]: - annotate(frame, loc, annotation) + if len(mask) > 0: + for loc in frame.index[mask]: + annotate(frame, loc, annotation) def invalidate_records(frame, check_name): for index,percent in frame.ix[frame[check_name] > 0, check_name].iteritems(): @@ -122,6 +123,10 @@ class BaseCheckList: filtered_frame = frame.ix[frame.qc_percent < 1].copy() for check, metadata in self.checks.items(): original_shape = filtered_frame.shape - filtered_frame = check(filtered_frame, self.parameters) + if len(filtered_frame) > 0: + filtered_frame = check(filtered_frame, self.parameters) + else: + for v in metadata['updates']: + filtered_frame[v] = [] assert np.in1d(list(metadata['updates']), filtered_frame.columns).all() return self.update_qc_percent(filtered_frame.combine_first(frame)) -- GitLab