diff --git a/saqc/funcs/breaks.py b/saqc/funcs/breaks.py index ae6791afd1e4ea7a3da60e907f6749daa090e9cc..4d34a550a55167fe594af0c312d4bc0e96f091b8 100644 --- a/saqc/funcs/breaks.py +++ b/saqc/funcs/breaks.py @@ -20,16 +20,22 @@ from saqc.constants import * from saqc.lib.tools import groupConsecutives from saqc.lib.types import FreqString, ColumnName, IntegerWindow from saqc.funcs.changepoints import assignChangePointCluster -from saqc.core import flagging, Flags +from saqc.core.flags import Flags +from saqc.core.history import History +from saqc.core.register import _isflagged, flagging -@flagging(masking="field", module="breaks") +# NOTE: +# masking="none" as we otherwise might interprete +# the masked values as missing data +@flagging(masking="none", module="breaks") def flagMissing( data: DictOfSeries, field: ColumnName, flags: Flags, nodata: float = np.nan, flag: float = BAD, + to_mask: float = UNFLAGGED, **kwargs ) -> Tuple[DictOfSeries, Flags]: """ @@ -55,11 +61,14 @@ def flagMissing( flags : saqc.Flags The quality flags of data """ + datacol = data[field] + if np.isnan(nodata): mask = datacol.isna() else: mask = datacol == nodata + mask = ~_isflagged(flags[field], to_mask) & mask flags[mask, field] = flag return data, flags diff --git a/saqc/funcs/flagtools.py b/saqc/funcs/flagtools.py index c5553dde9bfea49d499d2e3a4e934043c444a359..f75730b0c28efc578abeef02c0efc1b9a073f1a0 100644 --- a/saqc/funcs/flagtools.py +++ b/saqc/funcs/flagtools.py @@ -82,6 +82,7 @@ def clearFlags( forceFlags : set whole column to a flag value flagUnflagged : set flag value at all unflagged positions """ + # NOTE: do we really need this? if "flag" in kwargs: kwargs = {**kwargs} # copy flag = kwargs.pop("flag")