From 64cde50ad573eefd5ecb16f52c70e104767789f8 Mon Sep 17 00:00:00 2001
From: Peter Luenenschloss <peter.luenenschloss@ufz.de>
Date: Tue, 3 Dec 2019 17:36:59 +0100
Subject: [PATCH] harm_funcs - bug fix

---
 saqc/funcs/harm_functions.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/saqc/funcs/harm_functions.py b/saqc/funcs/harm_functions.py
index 9dd31852b..8eaa2e5f3 100644
--- a/saqc/funcs/harm_functions.py
+++ b/saqc/funcs/harm_functions.py
@@ -600,7 +600,7 @@ def _reshapeFlags(
             base = seconds_total / 2
             freq_string = str(int(seconds_total)) + "s"
             if (
-                abs(flags.index[0] - flags.index[0].ceil(freq))
+                abs(flagger._flags.index[0] - flagger._flags.index[0].ceil(freq))
                 <= pd.Timedelta(freq) / 2
             ):
                 shift_correcture = -1
@@ -609,7 +609,7 @@ def _reshapeFlags(
 
         # resampling the flags series with aggregation method
         flags = (
-            flagger_new.getFlags()
+            flagger.getFlags()
             # NOTE: otherwise the datetime index will get lost
             .squeeze()
             .resample(freq_string, closed=closed, label=label, base=base)
@@ -622,7 +622,7 @@ def _reshapeFlags(
         if method == "nearest_agg":
             flags = flags.shift(periods=-shift_correcture, freq=pd.Timedelta(freq) / 2)
 
-        flagger_new = flagger_new.initFlags(flags=flags.to_frame(name=field))
+        flagger_new = flagger.initFlags(flags=flags.to_frame(name=field))
 
     else:
         methods = ", ".join(shifts + ["\n"] + aggregations)
-- 
GitLab