Source code for hydro.exchange.flags

"""A Collection of Flag Schemes."""

from enum import IntEnum


[docs] class ExchangeFlag(IntEnum): def __init__(self, flag) -> None: self.flag = flag @property
[docs] def definition(self): return self._flag_definitions[self.flag]
@property
[docs] def cf_def(self): return "_".join(self.definition.lower().replace(".", "").split())
@property
[docs] def has_value(self): if self.flag in self._no_data_flags: return False return True
[docs] class ExchangeBottleFlag(ExchangeFlag): """Enum representing a WHP Bottle flag. This flag represents information about the sampling device itself (i.e. the niskin bottle). It should only be used for "BTLNBR_FLAG_W" values and should never be used with CTD files. """
[docs] NOFLAG = 0 # no idea if this will cause issue
[docs] NO_INFO = 1
[docs] GOOD = 2
[docs] LEAKING = 3
[docs] BAD_TRIP = 4
[docs] NOT_REPORTED = 5
[docs] DISCREPANCY = 6
[docs] UNKNOWN = 7
[docs] PAIR = 8
[docs] NOT_SAMPLED = 9
@property
[docs] def _no_data_flags(self): return (1, 5, 9)
@property
[docs] def _flag_definitions(self): return { 0: "No Flag assigned", 1: "Bottle information unavailable.", 2: "No problems noted.", 3: "Leaking.", 4: "Did not trip correctly.", 5: "Not reported.", 6: "Significant discrepancy in measured values between Gerard and Niskin bottles.", # noqa: E501 7: "Unknown problem.", 8: "Pair did not trip correctly. Note that the Niskin bottle can trip at an unplanned depth while the Gerard trips correctly and vice versa.", # noqa: E501 9: "Samples not drawn from this bottle.", }
[docs] class ExchangeSampleFlag(ExchangeFlag):
[docs] NOFLAG = 0 # no idea if this will cause issue
[docs] MISSING = 1
[docs] GOOD = 2
[docs] QUESTIONABLE = 3
[docs] BAD = 4
[docs] NOT_REPORTED = 5
[docs] MEAN = 6
[docs] CHROMA_MANUAL = 7
[docs] CHROMA_IRREGULAR = 8
[docs] NOT_SAMPLED = 9
@property
[docs] def _no_data_flags(self): return (1, 5, 9)
@property
[docs] def _flag_definitions(self): return { 0: "No Flag assigned", 1: "Sample for this measurement was drawn from water bottle but analysis not received.", # noqa: E501 2: "Acceptable measurement.", 3: "Questionable measurement.", 4: "Bad measurement.", 5: "Not reported.", 6: "Mean of replicate measurements", 7: "Manual chromatographic peak measurement.", 8: "Irregular digital chromatographic peak integration.", 9: "Sample not drawn for this measurement from this bottle.", }
[docs] class ExchangeCTDFlag(ExchangeFlag):
[docs] NOFLAG = 0 # no idea if this will cause issue
[docs] UNCALIBRATED = 1
[docs] GOOD = 2
[docs] QUESTIONABLE = 3
[docs] BAD = 4
[docs] NOT_REPORTED = 5
[docs] INTERPOLATED = 6
[docs] DESPIKED = 7
[docs] NOT_SAMPLED = 9
@property
[docs] def _no_data_flags(self): return (5, 9)
@property
[docs] def _flag_definitions(self): return { 0: "No Flag assigned", 1: "Not calibrated.", 2: "Acceptable measurement.", 3: "Questionable measurement.", 4: "Bad measurement.", 5: "Not reported.", 6: "Interpolated over a pressure interval larger than 2 dbar.", 7: "Despiked.", 9: "Not sampled.", }