/*
Operatoren: +, -, *, \
Functions: sqrt, exp, log, log10, sin, cos, tan, asin, acos, atan
Functions: min, max, avg, std, var
Constansts: M_PI, M_E
*/

@BeginModule
@NewPage
@Name      = Expr
@Title     = Evaluate expressions
@Section   = Arithmetic
@Class     = Arithmetic
@Arguments = ifile ofile
@Operators = expr exprf

@BeginDescription
This module arithmetically processes every time step of the input dataset.
Each individual assignment statement must end with a semi-colon.
@IfMan
The basic arithmetic operations addition +, subtraction -, multiplication *,
division / and exponentiation ^ can be used.
@EndifMan
@IfDoc
The basic arithmetic operations addition \begin{math}+\end{math}, subtraction \begin{math}-\end{math}, multiplication \begin{math}*\end{math},
division \begin{math}/\end{math} and exponentiation \^\  can be used.
@EndifDoc
The following intrinsic functions are available:
@BeginList log10(x)
@Item = sqrt(x)
Square Root of x
@Item = exp(x)
Exponential of x
@Item = log(x)
Natural logarithm of x
@Item = log10(x)
Base 10 logarithm of x
@Item = sin(x)
Sine of x, where x is specified in radians
@Item = cos(x)
Cosine of x, where x is specified in radians
@Item = tan(x)
Tangent of x, where x is specified in radians
@Item = asin(x)
Arc-sine of x, where x is specified in radians
@Item = acos(x)
Arc-cosine of x, where x is specified in radians
@Item = atan(x)
Arc-tangent of x, where x is specified in radians
@EndList
@EndDescription
@EndModule


@BeginOperator_expr
@Title     = Evaluate expressions
@Parameter = instr

@BeginDescription
The processing instructions are read from the parameter.
@EndDescription
@EndOperator


@BeginOperator_exprf
@Title     = Evaluate expressions from script file
@Parameter = filename

@BeginDescription
Contrary to @oper{expr} the processing instructions are read from a file.
@EndDescription
@EndOperator


@BeginParameter
@Item = instr
STRING  Processing instructions (without spaces!)
@Item = filename
STRING  File with processing instructions
@EndParameter


@BeginExample
Assume an input dataset contains at least the variables 'aprl', 'aprc'
and 'ts'. To create a new variable 'var1' with the sum
of 'aprl' and 'aprc' and a variable 'var2' which convert
the temperature 'ts' from Kelvin to Celsius use:
@BeginVerbatim
   cdo expr,'var1=aprl+aprc;var2=ts-273.15;' ifile ofile
@EndVerbatim
The same example, but the instructions are read from a file:
@BeginVerbatim
   cdo exprf,myexpr ifile ofile
@EndVerbatim
The file @file{myexpr} contains:
@BeginVerbatim
   var1 = aprl + aprc;
   var2 = ts - 273.15;
@EndVerbatim
@EndExample
