Skip to content

Commit

Permalink
Correctly testing each variable after modification.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenkehoe committed Jul 23, 2024
1 parent 6fdd924 commit c536a4c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tests/qc/test_qc_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,23 @@ def test_qc_summary():

result = ds.qcfilter.create_qc_summary(cleanup_qc=cleanup)

assert 'flag_masks' not in result[qc_var_name].attrs.keys()
assert isinstance(result[qc_var_name].attrs['flag_values'], list)
for var_name in ['temp_mean', 'rh_mean']:
assert 'flag_masks' not in result[qc_var_name].attrs.keys()
assert isinstance(result[qc_var_name].attrs['flag_values'], list)

assert np.sum(result[qc_var_name].values) == 610
assert np.sum(result[qc_var_name].values) == 610

qc_ma = result.qcfilter.get_masked_data(var_name, rm_assessments='Indeterminate')
assert np.all(np.where(qc_ma.mask)[0] == np.arange(100, 170))
qc_ma = result.qcfilter.get_masked_data(var_name, rm_assessments='Indeterminate')
assert np.all(np.where(qc_ma.mask)[0] == np.arange(100, 170))

qc_ma = result.qcfilter.get_masked_data(var_name, rm_assessments='Bad')
index = np.concatenate([index_1, index_2, index_3])
assert np.all(np.where(qc_ma.mask)[0] == index)
qc_ma = result.qcfilter.get_masked_data(var_name, rm_assessments='Bad')
index = np.concatenate([index_1, index_2, index_3])
assert np.all(np.where(qc_ma.mask)[0] == index)

assert "Quality control summary implemented by ACT" in result.attrs['history']

del ds


def test_qc_summary_multiple_assessment_names():
ds = read_arm_netcdf(EXAMPLE_MET1, cleanup_qc=True)
Expand Down

0 comments on commit c536a4c

Please sign in to comment.