Five Stars

Linear Interpolation

Is there a way to do a linear interpolation using a database feed and a lookup table? We receive continuous data from our onsite monitoring, and we need to lookup a reference table(see below) to get an output. The value of the continuous data references the first column and then interpolated output based on the second column is produced.

  For example, if we receive a value of 590.10ft, we would like to get an answer of ~13.4cfs.  We currently have excel spreadsheets and some old Python code that can produce this but is this possible using TOS?

 

[ft][cfs]
00
5900
590.027
590.0965
590.13112
590.18183
590.2215
590.25300
590.28356

 

 

Tags (1)
3 REPLIES
Twelve Stars

Re: Linear Interpolation

Yes. Just translate your Python code into Java and apply it in a Job.

Rilhia Solutions
Five Stars

Re: Linear Interpolation

Unfortunately, re-purposing the old python code isn't an option for us.

Twelve Stars

Re: Linear Interpolation

OK, well this may work for you.....

http://www.java2s.com/Code/Java/Collections-Data-Structure/LinearInterpolation.htm

 

You can plug that code into a Talend routine and use to carry out your calculation

Rilhia Solutions