Jump to content

Replace Gaps in Data with an Average Value from Previous Time Frame


Recommended Posts

  • Seeq Team

FAQ: I have a signal with a gap in the data from a system outage. I want to replace the gap with a constant value, ideally the average of the time period immediately before the data.

image.png

 

Solution:

1. Once you've identified your data gaps, extend the capsules backwards by the amount over which time you want to take the average. In this example, we want to fill in the gap with the average of the 10 minutes before the signal dropped, so we will extend the start of the data gap capsule 10 minutes in the past. This is done using the move function in Formula:

$conditionForDataGaps.move(-10min,0min)

image.png

2. Use Signal from Condition to calculate the average of the gappy signal during the condition created in step 1. Make sure to select "Duration" for the timestamp of the statistic. 

image.png

3. Stitch the two signals together using the splice function. The validvalues() function at the end ensures a continuous output signal. 

$gappysignal.splice($replacementsignal,$gaps).validvalues()

image.png

image.png

 

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...