cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Interpolate function not working as expected

ronyT
4-Participant

Interpolate function not working as expected

Hi All,
I have an infotable that has missing values (interpolate_1),
I use the following code (interpolate_params) to try and fill the gaps by the last element.

 

 

 

	var params = {
		mode: "INTERVAL" /* STRING */ ,
		timeColumn: "timestamp" /* STRING */ ,
		t: loggedValues /* INFOTABLE */ ,
		ignoreMissingData: false /* BOOLEAN */ ,
		stats: "LAST" /* STRING */ ,
		endDate: endDate /* DATETIME */ ,
		columns: "p1_plasma__cooling_water__conductivity__actual;p1_plasma__cooling_water__conductivity__limit_high" /* STRING */ ,
		count: 1000 /* NUMBER */ ,
		startDate: startDate /* DATETIME */
	};

	// result: INFOTABLE
	var interpolatedLogged = Resources["InfoTableFunctions"].Interpolate(params);

 

 

 

 

For some reason, the gaps are not filled, and the timestamp is not stretched correctly.
Please let me know what am I doing wrong ?

Thanks

6 REPLIES 6
Constantine
17-Peridot
(To:ronyT)

Hello @ronyT,

 

I did some quick test and fwiw it seems to work as expected with mode: "ROWCOUNT" and stats: "SMOOTH". I know that SMOOTH != LAST, but that's all that worked for me.

 

/ Constantine

ronyT
4-Participant
(To:Constantine)

Hi Costantine,

 

Thank you for your answer.
You are correct, "SMOOTH" works fine and as expected. However, when I put mode to "LAST", it only takes the last value for one element and does not replicate that value if you have more than one consecutive empty value.

 

I am not sure if this is the real intention of the function or it is a bug in the function.

Thank you for your test

Constantine
17-Peridot
(To:ronyT)

@ronyT, if you ask me, if something doesn't work as expected -- it's a bug (either in the code or in the docs).

 

/ Constantine

slangley
23-Emerald II
(To:ronyT)

Hi @ronyT.

 

The screenshots are from different dates, so we can't really tell anything from them.  Using the LAST method, the value for the new data point should be the last value in that interval.  Did you validate that there are values in the intervals you are reviewing?

 

We may need to open a case for this to determine if there is actually an issue in the product.  If so, we would follow up to report it as a defect.

 

Please let me know if you would like me to open a case on your behalf.

 

Regards.

 

--Sharon

ronyT
4-Participant
(To:slangley)

Hi,

 

Thank you for your answer.
I make sure I have the first row (oldest value) filled in the infotable before calling the interpolate. I always pass an infotable with at least the first row completely filled. When I change the mode to "SMOOTH" it works nicely, however with "LAST", it doesnt.
I made a workaround by using a double for loop (looping over fields, then looping over all rows) and fill the gaps by the last value.
I also opened a support ticket for that and waiting for an answer

Thank you.

Wolinski
4-Participant
(To:ronyT)

There are ways to do this, but like all interpolation methods, you need to have data at a scale smaller than the spatial scale of variations in the true surface being estimated. This is generally assumed, but not always correct. A good example is the problem with interpolating rainfall data.

Announcements


Top Tags