Skip to content

Commit 3e393e0

Browse files
committed
fix ValueError in velocity_hourly_timeseries
and update unittest to include this case fixes #124
1 parent 628f216 commit 3e393e0

4 files changed

Lines changed: 11 additions & 1 deletion

File tree

aodntools/timeseries_products/velocity_hourly_timeseries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def append_resampled_values(nc_cell, ds, slice_start, binning_functions):
5454
:param binning_functions: list of numpy function names for binning
5555
:return: end index of the slice
5656
"""
57-
df_cell = nc_cell.squeeze().to_dataframe()
57+
df_cell = nc_cell.to_dataframe().reset_index().set_index('TIME')
5858
# shift the index forward 30min to centre the bins on the hour
5959
df_cell.index = df_cell.index + pd.Timedelta(minutes=30)
6060

Binary file not shown.
Binary file not shown.

test_aodntools/timeseries_products/test_velocity_hourly_timeseries.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ def test_all_rejected(self):
7575
self.assertRaises(NoInputFilesError, velocity_hourly_aggregated, [BAD_FILE], 'NRSROT',
7676
input_dir=TEST_ROOT, output_dir='/tmp')
7777

78+
def test_size1_dimensions(self):
79+
input_files = [
80+
'IMOS_ANMN-NRS_ADCP_LAT_LON_DIMS.nc',
81+
'IMOS_ANMN-NRS_ADCP_SINGLE_TIMESTAMP.nc'
82+
]
83+
output_file, bad_files = velocity_hourly_aggregated(input_files, 'NRSROT',
84+
input_dir=TEST_ROOT, output_dir='/tmp')
85+
86+
self.assertEqual(0, len(bad_files))
87+
7888

7989
if __name__ == '__main__':
8090
unittest.main()

0 commit comments

Comments
 (0)