FunctionsCalculate

This program manipulates matrix files with data in columns. If several inputfiles are given the data columns are copied side by side. All inputfiles must contain the same number of rows. The columns are enumerated by data0, data1, … .

The content of outputfile is controlled by outColumn. The algorithm to compute the output is as follows: The expressions in outColumn are evaluated once for each row of the input. The variables data0, data1, … are replaced by the according values from the input columns before. Additional variables are available, e.g. index, data0rms, see dataVariables. If no outColumn are specified all input columns are used instead directly.

For a simplified handling constants can be defined by name=value, e.g. annual=365.25. It is also possible to estimate parameters in a least squares adjustment. The leastSquares serves as template for observation equations for every row. The expression leastSquares is evaluated for each row in the inputfile. The variables data0, data1, … are replaced by the according values from the input columns before. In the next step the parameters are estimated in order to minimize the expressions in leastSquares in the sense of least squares.

Afterwards complete rows are removed if one of the removalCriteria expressions for this row evaluates true (not zero).

An extra statistics file can be generated with one row of data. For the computation of the outColumn values all dataVariables are available (e.g. data3mean, data4std) inclusively the constants and estimated parameters but without the data0, data1, … itself. The variables and the numbering of the columns refers to the outputfile.

First example: To calculate the mean of two values at each row set outColumn to 0.5*(data1+data0).

Second example: An input file contain a column with times and a column with values. To remove a trend from the values define the parameters trend and bias. The observation equation in leastSquares is data1 - (trend*data0+bias). For output you can define the following columns for example:

The extra statistics file could contain in this case:

See also InstrumentArcCalculate, GriddedDataCalculate, MatrixCalculate.

NameTypeAnnotation
outputfile
filename
inputfile
filename
constant
expressiondefine a constant by name=value
parameter
expressiondefine a parameter by name[=value]
leastSquares
expressiontry to minimize the expression by adjustment of the parameters
removalCriteria
expressionrow is removed if one criterion evaluates true.
outColumn
expressionexpression to compute output columns (input columns are named data0, data1, ...)
statistics
sequence
outputfile
filenamematrix with one row, columns are user defined
outColumn
expressionexpression to compute statistics columns, data* are the outputColumns