Skip to content

Commit

Permalink
check variable values in test_hourly_timeseries
Browse files Browse the repository at this point in the history
  • Loading branch information
mhidas committed Apr 4, 2022
1 parent f4dca31 commit e6b4077
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Binary file not shown.
14 changes: 13 additions & 1 deletion test_aodntools/timeseries_products/test_hourly_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
BAD_FILE
]
INPUT_PATHS = [os.path.join(TEST_ROOT, f) for f in INPUT_FILES]
EXPECTED_OUTPUT_FILE = os.path.join(
TEST_ROOT, 'IMOS_ANMN-NRS_STZ_20181213_NRSROT_FV02_hourly-timeseries_END-20190523_C-20220404.nc'
)

INST_VARIABLES = {'instrument_id', 'source_file', 'LONGITUDE', 'LATITUDE', 'NOMINAL_DEPTH'}
OBS_VARIABLES = {'instrument_index', 'TIME'}
Expand All @@ -35,7 +38,7 @@


class TestHourlyTimeseries(BaseTestCase):
def test_hourly_aggregator(self):
def test_hourly_aggregator(self):
output_file, bad_files = hourly_aggregator(files_to_aggregate=INPUT_PATHS,
site_code='NRSROT',
qcflags=(1, 2),
Expand Down Expand Up @@ -73,6 +76,15 @@ def test_hourly_aggregator(self):
self.assertIn('hourly_timeseries.py', dataset.lineage)
self.assertIn(BAD_FILE, dataset.rejected_files)

# check variable values
expected = Dataset(EXPECTED_OUTPUT_FILE)
compare_vars = ('TIME', 'NOMINAL_DEPTH', 'instrument_index',
'TEMP', 'TEMP_count', 'TEMP_min', 'TEMP_max')
non_match_vars = [var for var in compare_vars
if not all(dataset[var][:] == expected[var][:])
]
self.assertEqual(non_match_vars, [])

def test_hourly_aggregator_with_nonqc(self):
output_file, bad_files = hourly_aggregator(files_to_aggregate=INPUT_FILES,
site_code='NRSROT',
Expand Down
2 changes: 1 addition & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
--index-url https://pypi.python.org/simple/
-r requirements.txt
-e .[testing]
-e .[testing]

0 comments on commit e6b4077

Please sign in to comment.