stateVector.mean
Take a mean over dimensions of variables in a state vector
Syntax
Description
Updates the settings for means for the listed variables. If the first input is -1, applies the settings to all variables currently in the state vector.
obj = obj.mean(variables, stateDimension)
Takes a mean over the indicated state dimension. The mean is taken over all elements of the dimension that are included in the state vector (i.e. over all state indices for the dimension).
Takes a mean over the indicated ensemble dimension. The mean is implemented using the specified mean indices. The mean for the dimension is calculated over elements located by applying the mean indices to particular elements along the dimension. If the dimension does not have a sequence, the mean indices are applied to the reference element. If the dimension has a sequence, applies the mean indices to each individual sequence element.
Takes a mean over multiple dimesions. If every listed dimension is a state dimension, you do not need to provide the third input (the mean indices). Specify mean indices if the dimensions list contains any ensemble dimensions. Use an empty array for the indices of any state dimensions.
Specify how to treat NaN elements along each dimension. Default is to include NaN values.
obj = obj.mean(variables, dimensions, “none”)
Discards any previously-specified options for taking a mean for the listed dimensions. No mean will be taken over the dimensions when building state vector ensembles.
obj = obj.mean(variables, dimensions, “unweighted”)
Discards any previously-specified weights for use in a weighted mean for the listed dimensions. The state vector will still take a mean over the listed dimensions, but the mean will be unweighted. This option is only valid for dimensions that take either a mean or a weighted mean. The dimensions list should not include dimensions that do not take a mean at all.
Input Arguments
v
variableNames
dimensions
indices
The mean indices show how to locate elements used in a mean over an ensemble dimension. If the dimension does not use a sequence, the mean indices are added to the reference element of each ensemble member. The mean is then taken over the resulting data elements. If the dimension uses a sequence, a mean will be taken over each sequence element. First, sequence indices are added to the reference element to give a set of sequence elements. Then, the mean indices are added to each sequence element and a mean is taken over each set of resulting data elements.
If a single dimension is listed, and the dimension is a state dimension, you do not need to provide mean indices as an input. If the single dimension is an ensemble dimension, you may provide the mean indices directly as a vector, rather than in a scalar cell. However, the scalar cell syntax is also permitted.
omitnan
[true|”omitnan”]: Omit NaN values when taking means
[false|”includenan” (default)]: Include NaN values in means.