pytimber.SparkLoggingDB.get_scaled

SparkLoggingDB.get_scaled(pattern: str | Iterable[str], t1: str | datetime | datetime64 | timedelta | int | int64 | float, t2: str | datetime | datetime64 | timedelta | int | int64 | float, unix_time: bool = True, scale_algorithm: ScaleAlgorithm = ScaleAlgorithm.SUM, scale_interval: ScaleInterval = ScaleInterval.MINUTE, scale_size: int = 1) Dict[str, T]

Retrieves the scaled data for the given pattern of variables in a time window from t1 to t2.

If no pattern if given for the fundamental all the data are returned.

If a fundamental pattern is provided, the end of the time window has to be explicitly provided.

Applies the scaling with supplied scaleAlgorithm, scaleSize, and scaleInterval.

Parameters:
  • pattern – A pattern or list of names to search for variables.

  • t1 – The start time of the time window, as a timestamp or a datetime object.

  • t2 – The end time of the time window, as a timestamp or a datetime object.

  • unix_time – Whether to return POSIX timestamps as float values. If True, return POSIX timestamps. If False, return datetime objects. Default value is True.

  • scale_algorithm – The scaling algorithm to apply. Default is “ScaleAlgorithm.SUM”.

  • scale_interval – The interval on which to apply the scaling. Default is “ScaleInterval.MINUTE”.

  • scale_size – The size of the scaling interval, as an integer. Default value is 1.

Returns:

A dictionary of data points, with variable names as keys and tuple of arrays as values. If unix_time is True, the timestamps are in POSIX format. Otherwise, they are datetime objects.

If the query has no result, an empty dictionary is returned.