time_stream.qc.TimeRangeCheck

class time_stream.qc.TimeRangeCheck(min_value, max_value, closed='both', within=True)[source]

Flag rows where the primary time column of the time series fall within an acceptable range.

This can either be used with min / max values of:
  • datetime.timeUseful for scenarios where there are consistent errors at a certain time of day,

    e.g., during an automated sensor calibration time.

  • datetime.dateUseful for scenarios where a specific date range is known to be bad,

    e.g., during a time of sensor errors not picked up elsewhere.

  • datetime.datetime : As above, but where there you need to add a time to the date range as well.

Note: This is equivalent to using RangeCheck with check_column = ts.time_name. However, adding this as a

convenience method as it may not be obvious that the RangeCheck can be used for this purpose.

Parameters:
  • min_value (float | time | date | datetime)

  • max_value (float | time | date | datetime)

  • closed (str | ClosedInterval)

  • within (bool)

__init__(min_value, max_value, closed='both', within=True)

Initialise range check.

Parameters:
  • min_value (float | time | date | datetime) – Minimum of the range.

  • max_value (float | time | date | datetime) – Maximum of the range.

  • closed (str | ClosedInterval) – Define which sides of the interval are closed (inclusive) {‘both’, ‘left’, ‘right’, ‘none’} (default = “both”)

  • within (bool) – Whether values get flagged when within or outside the range (default = True (within)).

Return type:

None

Methods

__init__(min_value, max_value[, closed, within])

Initialise range check.

apply(df, time_name, check_column[, ...])

Apply the QC check to the data.

available()

Return a sorted list of available registered keys.

expr(ctx, column)

Return the Polars expression for range checking.

get(spec, **kwargs)

Resolve spec to an instance of Self:

register(register_cls)

A method used as a decorator for subclasses to add to the register by its name attribute.

Attributes

name