From 8f676ee6263a57e38aafc24b1236b9a8f65ca4e9 Mon Sep 17 00:00:00 2001
From: David Schaefer <david.schaefer@ufz.de>
Date: Wed, 11 Dec 2019 00:09:26 +0100
Subject: [PATCH] fixed bug: using a variable not listed in the configuration
 file within in a generic test failed

---
 saqc/funcs/functions.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/saqc/funcs/functions.py b/saqc/funcs/functions.py
index f626cb23e..55ea5b172 100644
--- a/saqc/funcs/functions.py
+++ b/saqc/funcs/functions.py
@@ -21,7 +21,9 @@ def flagGeneric(data, field, flagger, func, **kwargs):
     #   DmpFlagger.isFlagged does not preserve the name of the column
     #   it was executed on -> would be nice to overcome this restriction
     flags_field = func.name if func.name in data.columns else field
-    mask = func.squeeze() | flagger.isFlagged(flags_field)
+    mask = func.squeeze()
+    if flags_field in flagger.getFlags():
+        mask |= flagger.isFlagged(flags_field)
     if np.isscalar(mask):
         raise TypeError(f"generic expression does not return an array")
     if not np.issubdtype(mask.dtype, np.bool_):
-- 
GitLab