Class: Formula

Formula(formula, builder)

This converts a mathematical formula into a openEO process for you.

Operators: - (subtract), + (add), / (divide), * (multiply), ^ (power)

It supports all mathematical functions (i.e. expects a number and returns a number) the back-end implements, e.g. sqrt(x).

Only available if a builder is specified in the constructor: You can refer to output from processes with a leading #, e.g. #loadco1 if the node to refer to has the key loadco1.

Only available if a parent node is set via setNode(): Parameters can be accessed simply by name. If the first parameter is a (labeled) array, the value for a specific index or label can be accessed by typing the numeric index or textual label with a $ in front, for example $B1 for the label B1 or $0 for the first element in the array. Numeric labels are not supported.

An example that computes an EVI (assuming the labels for the bands are NIR, RED and BLUE): 2.5 * ($NIR - $RED) / (1 + $NIR + 6 * $RED + (-7.5 * $BLUE))

Constructor

new Formula(formula, builder)

Creates a math formula object.

Parameters:
Name Type Description
formula string

A mathematical formula to parse.

builder Builder

The builder instance to add the formula to.

Source:

Methods

generate(setResultNode) → {BuilderNode}

Generates the processes for the formula specified in the constructor.

Returns the last node that computes the result.

Parameters:
Name Type Default Description
setResultNode boolean true

Set the result flag to true.

Source:
Throws:
Error
Returns:
Type
BuilderNode