Skip to main content
Solved

derived timeseries


Forum|alt.badge.img+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?

 

 

Best answer by Carin Meems

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.

View original
Did this topic help you find an answer to your question?

3 replies

  • Practitioner
  • 20 replies
  • October 17, 2023

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


Forum|alt.badge.img+2
  • Author
  • 42 replies
  • October 17, 2023

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. 


  • Seasoned Practitioner
  • 223 replies
  • Answer
  • October 19, 2023

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


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings