This icon allows specifying formulas of one of the following types:
- operations between one GRIB/Geopoints icon and a scalar
- operations between two GRIB/Geopoints icons
- functions of one or two GRIB/Geopoints icons or of a GRIB/Geopoints icon and a scalar value
For more complex operations please use a related icon named Formula. The result of the operation returned by Simple Formula can be either :
- GRIB data - depending on the option specified in the icon menu, the resulting GRIB data can be visualised, dropped, examined or saved as a GRIB file icon on your desktop
- Geopoints data - depending on the option specified in the icon menu, the resulting Geopoints data can be visualised, dropped or saved as a Geopoints file icon on your desktop
This icon cannot be called from Macro/Python but these computations can easily be implemented in both languages. If you are unsure about the exact translation, drop the prepared Simple Formula icon inside a Metview Macro/Python editor window to automatically generate the code.
The Simple Formula Editor
The Simple Formula editor belongs to a type of editors known as family editors which allows related sets of input specifications to be grouped in the same icon editor. The main computation type can be set via the Application parameter which offers these options:
- F+G - operations between two GRIB/Geopoints icons
- F+x - operations between GRIB/Geopoints icon and scalar
- x+F - operations between scalar and GRIB/Geopoints icon
- f(F) - functions of GRIB/Geopoints icon
- f(F,G) - functions of two GRIB/Geopoints icons
- f(F,x) - functions of GRIB/Geopoints icon and scalar
- f(x,F) - functions of scalar and GRIB/Geopoints icon
To operate with this icon first you need to select which type of operation you want to use (in Application). The available parameters will then change in the editor according to your selection.
Parameter
Specifies a single input element to a formula. It uses either a text field (to accept scalars) or an icon field (to accept a GRIB/Geopoints icon) depending on the formula required.
Parameter 1
Specifies the first input element of a formula. It uses either a text field (to accept scalars) or an icon field (to accept a GRIB/Geopoints icon) depending on the formula required.
Parameter 2
Specifies the second input element of a formula. It uses either a text field (to accept scalars) or an icon field (to accept a GRIB/Geopoints icon) depending on the formula required.
Operator
Specifies the operator to be used in the formula. The options are as follows:
Operator | Description |
---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
^ | Power |
> | Larger Than |
< | Smaller Than |
>= | Larger or Equal |
<= | Smaller or Equal |
= | Equal |
<> | Not equal |
and | Conjunction |
or | Disjunction |
Remember that the logical operators (last 4 lines) return data which is either 1 (result is true) or 0 (result is false).
Function
Specifies the function to be applied to the input defined in Parameter or in Parameter 1 and Parameter 2. The available options depend on the mode we set in Application.
When Application is set to f(F) the available options are as follows:
Function | Description |
---|---|
-- | negative of the input |
not | negation of input : returns 0 where input values are non-zero, 1 otherwise |
sgn | sign of the input : -1 where input is negative, 1 where positive, 0 where null |
int | integer part of the input |
abs | absolute part of the input |
sqrt | square root of the input |
log | natural logarithm of the input |
log10 | logarithm base 10 of the input |
exp | exponential of the input |
sin | sine of input (must be in radians) |
cos | cosine of input (must be in radians) |
tan | tangent of input (must be in radians) |
asin | arc sine of input (must be in radians) |
acos | arc cosine of input (must be in radians) |
atan | arc tangent of input (must be in radians) |
coslat | cosine of the latitude of the input grid points |
sinlat | sine of the latitude of the input grid points |
count | the number of fields within the input |
mean | mean field of the input. Apply to GRIB input only |
rms | root mean square field of the input. Apply to GRIB input only |
stdev | standard deviation field of the input. Apply to GRIB input only |
sum | sum field of the input |
var | variance field of the input. Apply to GRIB input only |
Note that some options apply only to GRIB icon input.
When Application is set to f(F,G) the available options are as follows:
Function | Description |
---|---|
max | returns the maximum of the two input elements: a GRIB/Geopoints of the maximum of the input GRIB/Geopoints at each grid point or location. Output GRIB data contain the same number of fields as the maximum is taken on a field by field basis |
min | as above but returning the minimum |
covar | returns a GRIB field equal to the covariance of the input fieldsets. Apply only to GRIB input |
div | returns the integer result of division of F by G |
merge | returns a single GRIB fieldset composed of all the fields in the input GRIB fieldsets. Apply only to GRIB input |
mod | returns the result of F modulo G |
interpolate | returns a set of Geopoints at the locations of the Geopoints specified by G, with values calculated by interpolation at those points from the first field of fieldset F |
When Application is set to f(F,x) or f(x,F) the available options are as follows:
max | returns the maximum of the two input elements: a GRIB/Geopoints of the maximum of the input GRIB/Geopoints at each grid point or location and the specified location. Output GRIB data contain the same number of fields as the maximum is taken on a field by field basis |
min | as above but returning the minimum |