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

Merge branch 'bugfix-harmonization' into 'master'

bugfix for nearest aggregation/shift correcture

See merge request !6
parents 93696a20 2befa42f
No related branches found
No related tags found
1 merge request!6bugfix for nearest aggregation/shift correcture
Pipeline #2387 passed with stage
in 9 minutes and 9 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