diff --git a/aodntools/timeseries_products/velocity_hourly_timeseries.py b/aodntools/timeseries_products/velocity_hourly_timeseries.py index 35cc60f..c13272e 100644 --- a/aodntools/timeseries_products/velocity_hourly_timeseries.py +++ b/aodntools/timeseries_products/velocity_hourly_timeseries.py @@ -54,7 +54,7 @@ def append_resampled_values(nc_cell, ds, slice_start, binning_functions): :param binning_functions: list of numpy function names for binning :return: end index of the slice """ - df_cell = nc_cell.squeeze().to_dataframe() + df_cell = nc_cell.to_dataframe().reset_index().set_index('TIME') # shift the index forward 30min to centre the bins on the hour df_cell.index = df_cell.index + pd.Timedelta(minutes=30) diff --git a/test_aodntools/timeseries_products/IMOS_ANMN-NRS_ADCP_LAT_LON_DIMS.nc b/test_aodntools/timeseries_products/IMOS_ANMN-NRS_ADCP_LAT_LON_DIMS.nc new file mode 100644 index 0000000..0578737 Binary files /dev/null and b/test_aodntools/timeseries_products/IMOS_ANMN-NRS_ADCP_LAT_LON_DIMS.nc differ diff --git a/test_aodntools/timeseries_products/IMOS_ANMN-NRS_ADCP_SINGLE_TIMESTAMP.nc b/test_aodntools/timeseries_products/IMOS_ANMN-NRS_ADCP_SINGLE_TIMESTAMP.nc new file mode 100644 index 0000000..62bc5d6 Binary files /dev/null and b/test_aodntools/timeseries_products/IMOS_ANMN-NRS_ADCP_SINGLE_TIMESTAMP.nc differ diff --git a/test_aodntools/timeseries_products/test_velocity_hourly_timeseries.py b/test_aodntools/timeseries_products/test_velocity_hourly_timeseries.py index 5f734b7..9c3ee4c 100644 --- a/test_aodntools/timeseries_products/test_velocity_hourly_timeseries.py +++ b/test_aodntools/timeseries_products/test_velocity_hourly_timeseries.py @@ -75,6 +75,16 @@ def test_all_rejected(self): self.assertRaises(NoInputFilesError, velocity_hourly_aggregated, [BAD_FILE], 'NRSROT', input_dir=TEST_ROOT, output_dir='/tmp') + def test_size1_dimensions(self): + input_files = [ + 'IMOS_ANMN-NRS_ADCP_LAT_LON_DIMS.nc', + 'IMOS_ANMN-NRS_ADCP_SINGLE_TIMESTAMP.nc' + ] + output_file, bad_files = velocity_hourly_aggregated(input_files, 'NRSROT', + input_dir=TEST_ROOT, output_dir='/tmp') + + self.assertEqual(0, len(bad_files)) + if __name__ == '__main__': unittest.main()