Skip to content

Commit b2e8f4f

Browse files
committed
simplify 30min time shift for resample
1 parent 786d8ae commit b2e8f4f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

aodntools/timeseries_products/velocity_hourly_timeseries.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ def get_resampled_values(nc_cell, ds, slice_start, varlist, binning_function, ep
5454
"""
5555
df_cell = nc_cell[varlist].squeeze().to_dataframe()
5656
## back the index 30min
57-
df_cell.index = df_cell.index - pd.Timedelta(minutes=30)
57+
df_cell.index = df_cell.index + pd.Timedelta(minutes=30)
5858
# TODO: shift timestamps to centre of sampling interval
5959

6060
df_cell_1H = df_cell.resample('1H')
6161
slice_end = len(df_cell_1H) + slice_start
6262

6363
## move time it forward and get it
64-
time_slice = ((np.fromiter(df_cell_1H.groups.keys(), dtype='M8[ns]') + np.timedelta64(1, 'h')) - epoch) / one_day
64+
time_slice = (np.fromiter(df_cell_1H.groups.keys(), dtype='M8[ns]') - epoch) / one_day
6565
ds['TIME'][slice_start:slice_end] = time_slice
6666

6767
# take the mean of the variables

0 commit comments

Comments
 (0)