sum
- sum(fs, missing=False, dim=None, preserve_dims=None)
Computes the point-wise sum of the values in
fs.- Parameters
fs (
Fieldset) – input fieldsetmissing (bool) – controls what happens when missing values are present in
fs. When it isFalse, a missing value in any of the fields at a given gridpoint will result in a missing value in the corresponding gridpoint in the output. If it isTrueall the non-missing values across the fields at a given grid point will be used to compute the sum. This parameter is new in Metview version 5.16.0. In earlier versions the computations are carried out as ifmissingwas set toFalse.dim (str) – restrict the computations to a single dimension of the data - see main text below. New in metview-python version 1.13.0.
preserve_dims (list) – may be used in conjunction with parameter
dim- see main text below. New in metview-python version 1.13.0.
- Return type
The output is a
Fieldsetwith one field only.With N fields in
fsby denoting the i-th value in the k-th field by \(x_{i}^{k}\) the output values can be written as:\[s_{i} = \sum_{k}^{N} x_{i}^{k}\]To understand how to perform computations over a single ‘dimension’ of the data, see the documentation for the
mean()function.Note
See also
mean().