Solved

derived timeseries

  • 17 October 2023
  • 3 replies
  • 38 views

Badge +2

I have a set of timeseries objects t1,t2,t3,t4,t5…..etc. Now I would like to create a derived timeseries objects based on the existing timeseries objects. For instance 

 T1 = (t1/1000) *141.5

T2 = (t2/100 - t3)

T3 = (t3/100 - 14)

T4 = t4 * t2/100

T5 = t5/100

How do I perform these steps using cognite SDK. Is there a way to perform these operations?

Please advise. 

Retrieving dataframe from data-points and then create new timeseries objects (T1,T2….) will be challenging and hence wanted if there is an optimal way to handle this in a better way. Is this possible using synthetic time-series?

IS there some examples and code snippets that can be shared so that I can grasp them better?

 

 

icon

Best answer by Carin Meems 19 October 2023, 12:22

View original

3 replies

Hi @eashwar11, yes, there certainly exists examples in the docs. See here. Let us know if the examples are not clear.

Badge +2

Thanks @HaydenH . But I have to do this derived timeseries objects within a cognite function. I already have a function which creates the base timeseries and then adds the datapoints to the corresponding timeseries objects. I wanted to add the new timeseries as synthetic timeseries objects but don’t want to give any other parameters such as start, end, granularity etc. 

I am basically creating the base objects t1,t,2,3,t4,t5 and in the same sequence, I would like to add the subsequent objects T1,T2,T3 etc. as per the equations I gave above. 

Userlevel 3

Hi @eashwar11, as the documentation states: 

  • expressions (str | sympy.Expr | Sequence[str | sympy.Expr]) – Functions to be calculated. Supports both strings and sympy expressions. Strings can have either the API ts{} syntax, or contain variable names to be replaced using the variables parameter.
  • start (int | str | datetime) – Inclusive start.
  • end (int | str | datetime) – Exclusive end
  • limit (int | None) – Number of datapoints per expression to retrieve.
  • variables (dict[str, str | TimeSeries] | None) – An optional map of symbol replacements.
  • aggregate (str | None) – use this aggregate when replacing entries from variables, does not affect time series given in the ts{} syntax.
  • granularity (str | None) – use this granularity with the aggregate.

start and end are required parameters. So what you’re mentioning above is not possible. Please make sure you read the documentation carefully, that’ll help you get a better understanding of how to go about this.

Reply