Metview's documentation is now on readthedocs!

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:

OperatorDescription
+Addition
-Subtraction
*Multiplication
/Division
^Power
>Larger Than
<Smaller Than
>=Larger or Equal
<=Smaller or Equal
=Equal
<>Not equal
andConjunction
orDisjunction

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:

FunctionDescription
--negative of the input
notnegation of input : returns 0 where input values are non-zero, 1 otherwise
sgnsign of the input : -1 where input is negative, 1 where positive, 0 where null
intinteger part of the input
absabsolute part of the input
sqrtsquare root of the input
lognatural logarithm of the input
log10logarithm base 10 of the input
expexponential of the input
sinsine of input (must be in radians)
coscosine of input (must be in radians)
tantangent of input (must be in radians)
asinarc sine of input (must be in radians)
acosarc cosine of input (must be in radians)
atanarc tangent of input (must be in radians)
coslatcosine of the latitude of the input grid points
sinlatsine of the latitude of the input grid points
countthe number of fields within the input
meanmean field of the input. Apply to GRIB input only
rmsroot mean square field of the input. Apply to GRIB input only
stdevstandard deviation field of the input. Apply to GRIB input only
sumsum field of the input
varvariance 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:

FunctionDescription
maxreturns 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
minas above but returning the minimum
covarreturns a GRIB field equal to the covariance of the input fieldsets. Apply only to GRIB input
divreturns the integer result of division of F by G
mergereturns a single GRIB fieldset composed of all the fields in the input GRIB fieldsets. Apply only to GRIB input
modreturns the result of F modulo G
interpolatereturns 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:



maxreturns 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
minas above but returning the minimum