CDL - EVAL: Difference between revisions
(Created page with "== Introduction == The EVAL functions gives the possibility to modfy a measurement and plot the result as a separate line. So theoretically one could plot the Dewpoint as a ca...") |
m (→Functions) |
||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Introduction == |
== Introduction == |
||
'''The Equations are kind of in continuous BETA, by the nature of all possible combinations and the recursive parsing not all possible equations have been tested (haha)''' |
|||
⚫ | The EVAL functions gives the possibility to |
||
⚫ | The EVAL functions gives the possibility to modify a measurement and plot the result as a separate line. So theoretically one could plot the Dewpoint as a calculated derivative of the Temperature. Also the Growth Degree Days can be simply calculated. The effect of EVAL is that it is not required to transfer data if it can be derived from measurement. Only the measurement needs to be transferred. |
||
⚫ | |||
⚫ | |||
⚫ | |||
== Equation == |
|||
⚫ | |||
EVAL '[' Equation ']' |
|||
Equation := Term [ '+'|'-'|'*'|'/' Term ] |
|||
Term := '(' Equation ')' | Function '(' Equation ')' | Plotvariable | Number |
|||
Function := 'SUM' | 'LN' | 'EXP' |
|||
Number := <Integer>[.[<Integer>]] |
|||
NOTE: The plotvariable MUST be from the range as defined for the PLOT i.e. ALL | DAILY | RECENT. |
|||
== Functions == |
== Functions == |
||
Line 10: | Line 25: | ||
The SUM function produces the sum of the Plotvariable from the first of january to the 31 of december after which it resets to zero. So it is a cyclic function! |
The SUM function produces the sum of the Plotvariable from the first of january to the 31 of december after which it resets to zero. So it is a cyclic function! |
||
When applied to the temperature this leads to the Growing Degree Days, when applied to rain it leads to the yearly rainfall until the current day. For other variables it may have meaning or it may have not. |
When applied to the temperature this leads to the Growing Degree Days, when applied to rain it leads to the yearly rainfall until the current day. For other variables it may have meaning or it may have not. |
||
At the moment there can be only one sum function per chart. |
|||
The following example shows the daily average temperature modified to the Growing Degree Days with an offset of 5 °C: |
The following example shows the daily average temperature modified to the Growing Degree Days with an offset of 5 °C: |
||
Line 17: | Line 34: | ||
PLOT ALL AverageTemp EVAL [ SUM(AverageTemp-5) ] colour green Axis DegreeDays |
PLOT ALL AverageTemp EVAL [ SUM(AverageTemp-5) ] colour green Axis DegreeDays |
||
EndChart |
EndChart |
||
=== LN === |
|||
The LN function provides the [https://en.wikipedia.org/wiki/Natural_logarithm Natural Logarithm] (the logarithm on the basis of the Euler number e). |
|||
It is implemented as the JavaScript function ''Math.log''. |
|||
=== EXP === |
|||
The EXP function provides the power function for the base of the Euler number e. |
|||
It is implemented as the JavaScript ''Math.exp''. |
|||
[[Category:CumulusUtils]] |
Latest revision as of 16:33, 21 February 2023
Introduction
The Equations are kind of in continuous BETA, by the nature of all possible combinations and the recursive parsing not all possible equations have been tested (haha)
The EVAL functions gives the possibility to modify a measurement and plot the result as a separate line. So theoretically one could plot the Dewpoint as a calculated derivative of the Temperature. Also the Growth Degree Days can be simply calculated. The effect of EVAL is that it is not required to transfer data if it can be derived from measurement. Only the measurement needs to be transferred.
To be able to accomplish the calculations, one needs certain additional functions such as SUM, LN and EXP. The functions which are available to the user are described below. The list will grow as the functions become available.
Equation
Each equation is formulated between square brackets and is meant to modify a weather variable. Available to the user are functions, the weather variables and the mathematical operators +, -, * and /. EVAL Equations are more or less formally described as:
EVAL '[' Equation ']'
Equation := Term [ '+'|'-'|'*'|'/' Term ]
Term := '(' Equation ')' | Function '(' Equation ')' | Plotvariable | Number
Function := 'SUM' | 'LN' | 'EXP'
Number := <Integer>[.[<Integer>]]
NOTE: The plotvariable MUST be from the range as defined for the PLOT i.e. ALL | DAILY | RECENT.
Functions
SUM
The SUM function produces the sum of the Plotvariable from the first of january to the 31 of december after which it resets to zero. So it is a cyclic function! When applied to the temperature this leads to the Growing Degree Days, when applied to rain it leads to the yearly rainfall until the current day. For other variables it may have meaning or it may have not.
At the moment there can be only one sum function per chart.
The following example shows the daily average temperature modified to the Growing Degree Days with an offset of 5 °C:
CHART GrowingDgreeDays TITLE TempSum with offset 5 PLOT ALL AverageTemp colour CornflowerBlue as column PLOT ALL AverageTemp EVAL [ SUM(AverageTemp-5) ] colour green Axis DegreeDays EndChart
LN
The LN function provides the Natural Logarithm (the logarithm on the basis of the Euler number e). It is implemented as the JavaScript function Math.log.
EXP
The EXP function provides the power function for the base of the Euler number e. It is implemented as the JavaScript Math.exp.