solarforecastarbiter.validation.quality_mapping.mask_flags(flag_description, invert=True)[source]

Decorator that will convert a boolean pandas object into an integer, bitmasked object when _return_mask=True. This decorator adds the _return_mask kwarg to the decorated function. Using this decorator to mask values ensures the description and decorated function are clearly linked.

  • flag_description (str) – Description of the flag to convert from a boolean to integer. Must be a key of the DESCRIPTION_MASK_MAPPING dict.
  • invert (boolean) – Whether to invert the boolean object before conversion e.g. if flag_description = ‘LIMITS EXCEEDED’ and a True value indicates that a parameter is within the limits, invert=True is required for the proper mapping.

flags (pandas Object) – Returns the output of the decorated function (which must be a pandas Object) as the original output or an object of type int with value determined by the truthiness of the orignal output and flag_description