Skip to content
Snippets Groups Projects
Commit 16a840d3 authored by Bert Palm's avatar Bert Palm 🎇
Browse files

fixed flagger bug.

Now giving an empty list to isFlagged return the correct result, an all-False series/dios.

    flagger.isFlagged(flag=[])

Before a nearly all-True data was returned, because of a call to notna(), that was not protected by the loop.
parent 375d773e
No related branches found
No related tags found
3 merge requests!193Release 1.4,!188Release 1.4,!52Masking b
......@@ -194,12 +194,19 @@ class BaseFlagger(ABC):
flags = self.getFlags(field, loc)
cp = COMPARATOR_MAP[comparator]
# notna() to prevent nans to become True, eg.: `np.nan != 0 -> True`
# notna() to prevent nans to become True,
# eg.: `np.nan != 0 -> True`
flagged = flags.notna()
for f in flags_to_compare:
if not self.isValidFlag(f):
raise ValueError(f"invalid flag: {f}")
flagged &= cp(flags, f)
# passing an empty list must result
# in a everywhere-False data
if len(flags_to_compare) == 0:
flagged[:] = False
else:
for f in flags_to_compare:
if not self.isValidFlag(f):
raise ValueError(f"invalid flag: {f}")
flagged &= cp(flags, f)
return flagged
......
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