191. TableInterpolation

This function performs a lookup in a given table slot, based on a given value in a given column, and evaluates to the corresponding value in the other given column.

Description

Table lookup with linear interpolation.

Type

NUMERIC

Arguments

Type

Meaning

1

SLOT

table slot in which to do lookup

2

NUMERIC

"from" column

3

NUMERIC

"to" column

4

NUMERIC

value in "from" column

5

DATETIME

datetime context for unit conversions

Evaluation

The value argument is looked up in the "from" column of the given table slot to determine the corresponding value in the "to" column. If the exact value is not in the table, the lookup performs a linear interpolation between the two nearest bounding values in the "from" column and their corresponding values in the "to" column.

Mathematical Expression

TableInterpolation.jpg

Comments

If the given slot is not a table slot or if the "from" column or "to" column does not exist in the table, the function aborts the run with an error. Column numbers are zero based with a unit type of NONE. If the "from" value is not the same unit type as the "from" column, or the "from" value is not between the first and last value of the "from" column, the function aborts the run with an error.

Syntax Example:

TableInterpolation(Lake Mead.Elevation Volume Table, 0, 1,
1210.03 "ft", @"t")

TableInterpolation(Mead.Evaporation Table,
GetColumnIndex(Mead.Evaporation Table, "Julian Day"),
1, 1210.03 "ft", @"t")

Return Example:

234342422.32 "m"