Thursday, June 22, 2017

Python Advanced #14 - Using Lambda in Python for Interpolation

In my post on November 13, 2016, I showed how to interpolate values by using a function in Python.

That function is shown below.



The full post is located here:

Link for Interpolating Values Post

The function shown above computed a flow value given a stage along with the stages and flows above and below in the rating table.

In this post, I show how to perform the same computation using lambda in Python.  The coding to do this is shown below.



The results of this computation are given below.  Since I entered 2.5 as the stage value, I would expect the flow value to return 250 based on the values that I supplied for the bounding values of stage and flow.




No comments:

Post a Comment