Skip to main content
1-Visitor
March 30, 2020
Question

Interpolate function not working as expected

  • March 30, 2020
  • 2 replies
  • 3712 views

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

2 replies

18-Opal
March 30, 2020

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

ronyT1-VisitorAuthor
1-Visitor
March 30, 2020

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

18-Opal
March 30, 2020

@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

1-Visitor
April 7, 2020

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.