The default flag value is problematic
The default flag, provided for every test function, proves to be an hindrance for the implementation of translations schemes. In it's current incarnation (!237 (merged)), and in order to ensure consistency through forward and backward translation of user flags, only flag values available in the chosen scheme are allowed.
So if a scheme defines the following mapping {"UNFLAGGED": -np.inf, "OK": 0, "BAD": 1}
, then flag
in saqc.flagFoo(flag)
needs to be in {-np.inf, 0, 1}
. However, the signature of flagFoo
is flagFoo(flag=BAD)
, which is equivalent to flagFoo(flag=255.)
and that is illegal with such flagging scheme. So, in summary, if we plan to stick to the discussed translation behavior (i.e. failures, if a flag cannot be translated), then we need to remove the default flag
- value from the function signature.
Making flag
a required argument would be rather inconvenient, so one possibility to solve this issue is to provide a default flag through the translation scheme (like we will do for to_mask
). On the other hand, we also have functions, that don't have flag=UNFLAGGED
as a default value, so maybe this is also not working out... Any thoughts @palmb and @luenensc ?