PyANGKernel.GKTSDescription

class GKTSDescription

GKTSDescription holds the description of a time series, that is: the time interval during which a time series is valid and the time interval that separates each value in the series. It also holds, optionally, the deviation or a band for each of its values.

Details

Each time series ( GKTimeSerie ) has an associated description. Two (or more) time series can share the same description if their data is compatible (same time intervals and duration, same data type).

Synopsis

Methods

Virtual methods

Static functions

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

__init__(col, uniqueName, aIncludeDeviationValues, aIncludeBandsValues[, aExpandibleTS=false])
Parameters:
  • colGKColumn

  • uniqueName – str

  • aIncludeDeviationValues – bool

  • aIncludeBandsValues – bool

  • aExpandibleTS – bool

addInterval(interval)
Parameters:

interval – int

Adds a new interval to a time series that uses this description. If this new interval extends the duration of the TS, we will update the to time accordingly.

containsTime(time)
Parameters:

timeQDateTime

Return type:

bool

Returns true if time is in the interval [from,to]

containsTime(timeMS)
Parameters:

timeMS – int

Return type:

bool

Returns true if time (in MS since epoch) is the interval [from,to]

static defaultNullValue()
Return type:

float

static equals(a, b)
Parameters:
  • a – float

  • b – float

Return type:

bool

Compares a and b. NaN and +Inf/-Inf values supported Uses qFuzzyCompare beware of its shortcomings

expand(newTime)
Parameters:

newTimeQDateTime

Resets the initial time if ‘newTime’ is earlier, or the ending time, if ‘newTime’ is later than it, expanding the duration of the time series.

expandMaxMin(value)
Parameters:

value – float

Recalculates the maximum and minimum values taking into account the ‘value’ (that has been added to a time series).

static findCommonDates(t1, t2, from, to)
Parameters:

Find common dates (from, to) in two Timeseries.

static findCommonDatesWithCommonInterval(t1, t2, from, to)
Parameters:

Find common dates (from, to) in two Timeseries that have a common interval.

static findCommonTimes(t1, t2, from, to)
Parameters:

Find common times (from, to) in two Timeseries. The date in the date and time information is not used.

static findCommonTimesWithCommonInterval(t1, t2, from, to)
Parameters:

Find common times (from, to) in two Timeseries that have a common interval. The date in the date and time information is not used.

static findUnionDates(descriptions, from, to, interval)
Parameters:

Find the from/to/interval parameters that fit the union of the specified descriptions.

getAggregationType()
Return type:

AggregationType

When aggregating data, gives what is relevant: the mean or the sum.

getConversion()
Return type:

Conversion

Units of this TS.

static getCreateDescription(col, uniqueName[, aIncludeDeviation=false[, aIncludeBands=false]])
Parameters:
  • colGKColumn

  • uniqueName – str

  • aIncludeDeviation – bool

  • aIncludeBands – bool

Return type:

GKTSDescription

Find (and create a new one if none is found) a TS description by uniqueName.

static getCreateDescription(cols, uniqueName[, aIncludeDeviation=false[, aIncludeBands=false]])
Parameters:
  • cols – .list of GKColumn

  • uniqueName – str

  • aIncludeDeviation – bool

  • aIncludeBands – bool

Return type:

GKTSDescription

static getCreateDescription(col, uniqueName, scenario, aggType[, aIncludeDeviation=false[, aIncludeBands=false]])
Parameters:
Return type:

GKTSDescription

Find (and create a new one if none is found) a TS description by uniqueName. The scenario will be used to assign the GKTSDescription times ( from, to and interval )

static getCreateDescription(col, uniqueName, aFrom, aTo, anInterval, aggType[, aIncludeDeviation=false[, aIncludeBands=false]])
Parameters:
Return type:

GKTSDescription

Find (and create a new one if none is found) a TS description by uniqueName.

static getCreateDescription(cols, uniqueName, aFrom, aTo, anInterval, aggType[, aIncludeDeviation=false[, aIncludeBands=false]])
Parameters:
Return type:

GKTSDescription

getDuration(ts)
Parameters:

tsGKTimeSerie

Return type:

GKTimeDuration

Calculates the duration of a TS based on its from and to data or the interval.

getFromTime()
Return type:

QDateTime

getInterval(time[, exact=false])
Parameters:
Return type:

int

Return the interval (the position in the time series array of value) in where time is truncated to the nearest integer.

UnknownCommandtime : time for the interval that is being looked for UnknownCommand exact : if true, only times matching exact value timeshots are considered (thus it returns -1 for intermediate values)

If time is not in any valid interval, -1 is returned.

getInterval(time[, exact=false])
Parameters:
  • timeQTime

  • exact – bool

Return type:

int

Returns the interval (the position in the time series array of value) in where time is truncated to the nearest integer. QDate info is not used in the from and to times, only the QTime part.

UnknownCommandtime : time for the interval that is being looked for UnknownCommand exact : if true, only times matching exact value timeshots are considered (thus it returns -1 for intermediate values)

If time is not in any valid interval, -1 is returned.

getInterval(timeMS[, exact=false])
Parameters:
  • timeMS – int

  • exact – bool

Return type:

int

Return the interval (the position in the time series array of value) in where timeMS is truncated to the nearest integer.

UnknownCommandtimeMS : time in MS since epoch for the interval that is being looked for UnknownCommand exact : if true, only times matching exact value timeshots are considered (thus it returns -1 for intermediate values)

If time is not in any valid interval, -1 is returned.

getIntervalTime()
Return type:

GKTimeDuration

getIntervals(iStart, iEnd)
Parameters:
Return type:

.std.pairint,int

Get first and last interval for specified time interval.

getMaximum()
Return type:

float

Returns the maximum value of all the TS that uses this description.

getMinimum()
Return type:

float

Returns the minimum value of all the TS that uses this description.

getNrIntervals()
Return type:

int

Get the number of intervals

getNullValue()
Return type:

float

Returns the NULL value for this TS description. The user must first test if a NULL has been defined using hasNullValue .

getTimeFromInterval(pos)
Parameters:

pos – int

Return type:

QDateTime

Returns the time for a given interval position (based on from time and interval time).

getToTime()
Return type:

QDateTime

getTypeName()
Return type:

str

getUniqueName()
Return type:

str

hasNullValue()
Return type:

bool

Returns true if a NULL value for this TS description has been set.

static invalidValue()
Return type:

float

Returns the invalid value for this TS description. Case of no value importing value from the RDS when count is >0 for the specific dateTime.

isNull(value)
Parameters:

value – float

Return type:

bool

Returns true if “value” is used as a NULL (as defined with setNullValue ).

static isValid(aValue)
Parameters:

aValue – float

Return type:

bool

Returns true if “value” is used as a NULL (as defined with setNullValue ).

resetMinMax()

Resets the maximum and minimum values.

setAggregationType(type)
Parameters:

typeAggregationType

When aggregating data, sets what is relevant: the mean or the sum.

setConversion(type)
Parameters:

typeConversion

Units of this TS.

setFromTime(aFrom)
Parameters:

aFromQDateTime

Sets the initial time.

setIntervalTime(anInterval)
Parameters:

anIntervalGKTimeDuration

Sets the interval time.

setMinMax(min, max)
Parameters:
  • min – float

  • max – float

Sets the maximum and minimum values of the time series.

setNullValue(null)
Parameters:

null – float

Sets the value to be used as NULL (no value).

See also

hasNullValue()

setTime(aFrom, aTo, anInterval)
Parameters:

Sets the initial time (aFrom), ending time (aTo) and time interval.

setToTime(aTo)
Parameters:

aToQDateTime

Sets the ending time.

setToTimeKnow(value)
Parameters:

value – bool

If true, the end time will be used (even if no data is found) when computing the duration (in getDuration ). If false, the duration will be computed using the the interval time and the data in the TS.

Set it to true (the default) when the end time is well known, to false when the TS is dynamic and the end time is not known.

setTypeName(value)
Parameters:

value – str

toContext()
Return type:

GKContext

Returns the time information of this description as a GKContext .