A ‘Quality Expression’ consists of a set of quality names combined together using Boolean operators
into a legal Boolean expression. See this section for a description of the use of quality expressions
within IRQ. In the following, the symbols `A`

and `B`

are used to represent two qualities. These can be
considered as Boolean values; `true`

if a pixel holds the quality, and `false`

otherwise. The supported
Boolean operators are listed below.

- .AND.
- - The expression
`(A.AND.B)`

is true if and only if both`A`

and`B`

are true. - .OR.
- - The expression
`(A.OR.B)`

is true if and only if either`A`

or`B`

is true. - .XOR.
- - The expression
`(A.XOR.B)`

is true if and only if either`A`

is true and`B`

is false, or`A`

is false and`B`

is true. - .EQV.
- - The expression
`(A.EQV.B)`

is true if and only if either`A`

is true and`B`

is true, or A is false and`B`

is false. - .NOT.
- - The expression
`(.NOT.A)`

is true if and only if`A`

is false.

In addition to the above operators, the Boolean constants `.FALSE.`

and `.TRUE.`

can be included within
a quality expression. Expressions may contain several levels of nested parentheses.

The precedence of these operators decreases in the following order; .NOT., .AND., .OR., .XOR., .EQV.
(the final two have equal precedence). In an expression such as `(A.XOR.B.EQV.C.XOR.D)`

in which all
operators have equal precedence, the evaluation proceeds from left to right., *i.e.* the expression is
evaluated as (((A.XOR.B).EQV.C).XOR.D). If there is any doubt about the order in which an
expression will be evaluated, parentheses should be used to ensure the required order of
evaluation.

Some attempts are made to simplify a quality expression to reduce the run time needed to evaluate the expression for every pixel.

Quality expressions can be up to 254 characters long, and must not contain more than forty symbols (Boolean operators, constants, or quality names).

Copyright © 2009 Science and Technology Facilities Council.