diff --git a/test_aodntools/timeseries_products/IMOS_ANMN-NRS_STZ_20181213_NRSROT_FV02_hourly-timeseries_END-20190523_C-20220404.nc b/test_aodntools/timeseries_products/IMOS_ANMN-NRS_STZ_20181213_NRSROT_FV02_hourly-timeseries_END-20190523_C-20220404.nc new file mode 100644 index 0000000..d02738a Binary files /dev/null and b/test_aodntools/timeseries_products/IMOS_ANMN-NRS_STZ_20181213_NRSROT_FV02_hourly-timeseries_END-20190523_C-20220404.nc differ diff --git a/test_aodntools/timeseries_products/test_hourly_timeseries.py b/test_aodntools/timeseries_products/test_hourly_timeseries.py index d262cdf..0367728 100644 --- a/test_aodntools/timeseries_products/test_hourly_timeseries.py +++ b/test_aodntools/timeseries_products/test_hourly_timeseries.py @@ -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'} @@ -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), @@ -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', diff --git a/test_requirements.txt b/test_requirements.txt index 37c5457..67aeac6 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,3 +1,3 @@ --index-url https://pypi.python.org/simple/ -r requirements.txt --e .[testing] \ No newline at end of file +-e .[testing]