Solved

time series data - calculate time weighted average

  • 22 June 2023
  • 3 replies
  • 109 views

Badge +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)

 

icon

Best answer by Dilini Fernando 13 July 2023, 08:40

View original

3 replies

Userlevel 4

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.

Userlevel 4
Badge +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 

Userlevel 4
Badge +2

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

Reply