You are not logged in. Click here to log in.

Application Lifecycle Management

Search In Project

Search inClear

Calc #17080/HEAD / v10
Tags:  not added yet

DSL Element calc{}

Many analsysis examples are fully based on column data obtained from data files. However sometimes a derived data set should be used instead on an ad-hoc base. For example, to plot the sum of the difference of two data sets without computing this value in the model, or manipulating the date sets with other tools. Another example would be the ad-hoc creation of a mass balance term.

The calc element was introduced to support the creation of derived data sets for all analysis types (sub-elements). It allows the specification of an user defined equation operating on the elements of data columns. An example:

    ...
    analysis {
         timeseries(title:"Error") {
             x(file:"%last/out1.csv", column:"date")
             calc(eq:"simulated - observed") {
                 simulated(file:"%last/out1.csv", column:"basin_cfs")
                 observed(file:"%last/out1.csv", column:"runoff[0]")
             }
         ...
         }
     ...

The calc element in the example above is used as y axis. It has two major parts that relate to each other. First, the eq attribute takes a user defined term as string argument, in this case: "simulated - observed". The names are user defined, and they have to match the names that are used for column data that is enclosed in the calc element. The "simulated(...)", and "observed(...)" are two definitions of data columns with arbitrary names. As a rule any name being used in eq should occur as element within calc. Any complex term can be created in eq and calc can contain an arbitrary number of column references. As a result, the timeseries plot will have the element-wise diff of basin_cfs and runoff shown as the y axis.

The graph below shows two calculated data sets. The second definition below accumulates the calculated value of an element over the data set. The accu flag is set to true.

    ...
    analysis {
        timeseries(title:"Error") {
            x(file:"%last/out1.csv", column:"date")
            calc(eq:"simulated - observed") {
                simulated(file:"%last/out1.csv", column:"basin_cfs")
                observed(file:"%last/out1.csv", column:"runoff[0]")
            }
            calc(eq:"simulated - observed", accu:true) {
                simulated(file:"%last/out1.csv", column:"basin_cfs")
                observed(file:"%last/out1.csv", column:"runoff[0]")
            }
        }
    }
    ...

Element calc{}

Specification

Name
calc - calculate data sets ad-hoc

Properties Description Type Required
title Chart title String No
eq The equation String Yes
accu Accumulate flag True (default False) No

Sub-elements Description Type Default Occurrences
<name> Data set variable Value column One to many

Parent(s)
timeseries{}, scatter{}, flowduration{}

Notes

  • The sub elements must be referencing a column with numerical values.
  • Columns must have the same number of rows.
  • Names for sub elements must be unique.

Example