Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions aodntools/timeseries_products/hourly_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ def hourly_aggregator(files_to_aggregate, site_code, qcflags, input_dir='', outp
nc_clean['TIME'] = nc_clean.indexes['TIME'].to_datetimeindex()
df_temp = nc_clean.to_dataframe()

## keep TIME as the only index (for ADCP files it would be a MultiIndex at this point)
df_temp = df_temp.reset_index().set_index('TIME')
df_temp = df_temp[parameter_names]

df_temp = PDresample_by_hour(df_temp, function_dict, function_stats) # do the magic
Expand Down
13 changes: 13 additions & 0 deletions test_aodntools/timeseries_products/test_hourly_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@ def test_hourly_aggregator_with_nonqc(self):
for f in chartostring(dataset['source_file'][:]):
self.assertIn(f, INPUT_FILES)

def test_with_adcp(self):
# Replace the BAD_FILE with an ADCP file - aggregation should work (only takes TEMP from the ADCP)
input_files = INPUT_FILES[:2] + \
['IMOS_ANMN-NRS_AETVZ_20180816T080000Z_NRSROT-ADCP_FV01_NRSROT-ADCP-1808-Sentinel-or-Monitor-Workhorse-ADCP-44_END-20180822T053000Z_C-20200623T000000Z.nc']
output_file, bad_files = hourly_aggregator(files_to_aggregate=input_files,
site_code='NRSROT',
qcflags=(1, 2),
input_dir=TEST_ROOT,
output_dir='/tmp'
)

self.assertEqual(0, len(bad_files))

def test_all_rejected(self):
self.assertRaises(NoInputFilesError, hourly_aggregator, [BAD_FILE], 'NRSROT', (1, 2), input_dir=TEST_ROOT)

Expand Down