average

average(fs)

Computes the average of all the values for each field in fs.

Parameters

fs (Fieldset) – input fieldset

Return type

number or list or None

If there is only one field in fs a number is returned, otherwise a list is returned. Only non-missing values are considered in the calculation. If there are no valid values, the function returns NaN for that field.

Note

average() simply returns the mathematical average of all the field values using the following formula:

\[average = \frac {1}{N} \sum_{i}^{N}f_{i}\]

To get the physically correct average based on the grid cell areas use integrate().