Skip to content
Snippets Groups Projects
Commit 2befa42f authored by Peter Lünenschloß's avatar Peter Lünenschloß
Browse files

bugfix for nearest aggregation/shift correcture

parent 93696a20
No related branches found
No related tags found
1 merge request!6bugfix for nearest aggregation/shift correcture
Pipeline #2384 passed with stage
in 6 minutes and 51 seconds
......@@ -563,10 +563,10 @@ def _reshapeFlags(
base = seconds_total / 2
freq_string = str(int(seconds_total)) + "s"
i_start = flagger.getFlags().index[0]
if abs(i_start - i_start.ceil(freq)) <= pd.Timedelta(freq) / 2:
shift_correcture = -1
if abs(i_start - i_start.floor(freq)) <= pd.Timedelta(freq) / 2:
shift_correcture = 1
else:
shift_correcture = +1
shift_correcture = -1
# resampling the flags series with aggregation method
flags = (
......@@ -580,7 +580,7 @@ def _reshapeFlags(
)
if method == "nagg":
flags = flags.shift(periods=-shift_correcture, freq=pd.Timedelta(freq) / 2)
flags = flags.shift(periods=shift_correcture, freq=pd.Timedelta(freq) / 2)
# some consistency clean up to ensure new flags frame matching new data frames size:
if ref_index[0] != flags.index[0]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment