Skip to main content
Answer

time series data - calculate time weighted average

  • June 22, 2023
  • 3 replies
  • 138 views

Forum|alt.badge.img+2

I have a time series data identified with TAGS and that can contain around 1500 to 5000+ records generated per day. I would have to perform a time weighted average and calculate the time-weighted value for the time-series data for the given times. 

How do I proceed to recreate the computation in Cognite since I got the PI data already sitting within CDF.

 

Basically, got to recreate this function of OSI PI inside CDF

PIAdvCalcDat(tagname, stime, etime, interval, mode, calcbasis, minpctgood, cfactor, outcode, PIServer)

 

Best answer by Dilini Fernando

Hi @eashwar11,

I hope Everon’s reply was helpful. As of now, I will close this thread. If you need further clarification please feel free to post here.

Best regards,
Dilini

3 replies

Everton Colling
Seasoned Practitioner
Forum|alt.badge.img

Hi Eashwar!

What you are looking for is aggregations on time series data. Here’s a simple example of retrieving the average values for periods of 8 hours for the past week using the Python SDK:

data = client.time_series.data.retrieve(
external_id="FI-5002A.PV",
start="1w-ago",
end="now",
aggregates="average",
granularity="8h"
)

For more information on how to retrieve data points from time series, you can check the API documentation or one of the SDK documentations.

You can also read more about how aggregation works and the available options on the Cognite developer documentation.


Dilini Fernando
Seasoned Practitioner
Forum|alt.badge.img+2

Hi @eashwar11,

We're checking in to see if you're happy with the replies you've gotten.
If you found the responses offered by our community members to be instructive and helpful, we respectfully request that you consider designating the most helpful response as the "Best Answer."This small gesture both honors the individual who provided the answer and makes it easier for other community members to identify the most relevant comments.

Best regards,
Dilini 


Dilini Fernando
Seasoned Practitioner
Forum|alt.badge.img+2
  • Seasoned Practitioner
  • Answer
  • July 13, 2023

Hi @eashwar11,

I hope Everon’s reply was helpful. As of now, I will close this thread. If you need further clarification please feel free to post here.

Best regards,
Dilini