Axis Reductions¶
These functions compute summary statistics over specified axes of a variable. In general multiple axes can be reduced over at the same time. Many of them wrap similar numpy functions, though they are also capable of performing these operations on datasets too large to fit in memory. Most operations have two versions, one which computes the reduction including every element without checking for the presence of NaNs, and one which ignores any element which is a NaN, adjusting the relevant normalization.
- Var.mean(*axes, **kwargs)¶
Computes the mean of this variable. If weights are present on any of the axes, a weighted mean is computed by default.
- Parameters
- *axesany number of axis identifiers (string,
Axis
, or int) (optional) Axes over which the average should be computed. If none are provided, the mean is computed over the whole domain.
- weightsboolean or
Var
(optional) If provided, a weighted mean is performed. If True (the default), the default weights associated with the variable are used (getweights). If False, or None, no weighting is performed. Finally, custom weights can be provided in the form of a
Var
; this var must be defined on a subset of the axes being averaged over.
- *axesany number of axis identifiers (string,
- Returns
See also
- Var.nanmean(*axes, **kwargs)¶
Computes the mean of this variable, ignoring any NaNs in the domain.
- Parameters
- *axesany number of axis identifiers (string,
Axis
, or int) (optional) Axes over which the average should be computed. If none are provided, the mean is computed over the whole domain.
- weightsboolean or
Var
(optional) If provided, a weighted mean is performed. If True (the default), the default weights associated with the variable are used (getweights). If False, or None, no weighting is performed. Finally, custom weights can be provided in the form of a
Var
; this var must be defined on a subset of the axes being averaged over.
- *axesany number of axis identifiers (string,
- Returns
See also
- Var.sum(*axes, **kwargs)¶
Computes the sum of this variable. NB: Unlike mean, weights are not used by default.
- Parameters
- *axesany number of axis identifiers (string,
Axis
, or int) (optional) Axes over which the sum should be computed. If none are provided, the sum is computed over the whole domain.
- weightsboolean or
Var
(optional) If provided, a weighted sum is performed. If True, the default weights associated with the variable are used (getweights). If False or None (the default), no weighting is performed. Finally, custom weights can be provided in the form of a
Var
; this var must be defined on a subset of the axes being summed over.
- *axesany number of axis identifiers (string,
- Returns
See also
- Var.nansum(*axes, **kwargs)¶
Computes the sum of this variable, ignoring any NaNs.
- Parameters
- *axesany number of axis identifiers (string,
Axis
, or int) (optional) Axes over which the sum should be computed. If none are provided, the sum is computed over the whole domain.
- weightsboolean or
Var
(optional) If provided, a weighted sum is performed. If True, the default weights associated with the variable are used (getweights). If False or None (the default), no weighting is performed. Finally, custom weights can be provided in the form of a
Var
; this var must be defined on a subset of the axes being summed over.
- *axesany number of axis identifiers (string,
- Returns
See also
- Var.stdev(*axes)¶
Computes the standard deviation of this variable.
- Parameters
- *axesany number of axis identifiers (string,
Axis
, or int) (optional) Axes over which the standard deviation should be computed. If none are provided, the standard deviation is computed over the whole domain.
- *axesany number of axis identifiers (string,
- Returns
See also
- Var.nanstdev(*axes)¶
Computes the standard deviation of this variable, ignoring any NaNs present.
- Parameters
- *axesany number of axis identifiers (string,
Axis
, or int) (optional) Axes over which the standard deviation should be computed. If none are provided, the standard deviation is computed over the whole domain.
- *axesany number of axis identifiers (string,
- Returns
See also
- Var.variance(*axes, **kwargs)¶
Computes the variance of this variable.
- Parameters
- *axesany number of axis identifiers (string,
Axis
, or int) (optional) Axes over which the variance should be computed. If none are provided, the variance is computed over the whole domain.
- weightsboolean or
Var
(optional, default False) If provided, a weighted variance is calculated. If True, the default weights associated with the variable are used (getweights). If False, or None, no weighting is performed. Finally, custom weights can be provided in the form of a
Var
; this var must be defined on a subset of the axes being reduced.
- *axesany number of axis identifiers (string,
- Returns
See also
- Var.nanvariance(*axes)¶
Computes the variance of this variable, ignoring any NaNs.
- Parameters
- *axesany number of axis identifiers (string,
Axis
, or int) (optional) Axes over which the variance should be computed. If none are provided, the variance is computed over the whole domain.
- *axesany number of axis identifiers (string,
- Returns
- Var.min(*axes)¶
Computes the minimum value of this variable.
- Var.nanmin(*axes)¶
Computes the minimum value of this variable, ignoring NaNs.
- Var.max(*axes)¶
Computes the maximum value of this variable.
- Var.nanmax(*axes)¶
Computes the maximum value of this variable, ignoring NaNs.
- Var.argmin(axis)¶
Finds the index of the minumum value of this variable along the given axis.
- Parameters
- axisa single axis identifier (string,
Axis
, or int) (optional) Axis over which the index of the minimum should be found.
- axisa single axis identifier (string,
- Returns
See also
- Var.argmax(axis)¶
Finds the index of the maximum value of this variable along the given axis.
- Parameters
- axisa single axis identifier (string,
Axis
, or int) (optional) Axis over which the index of the maximum should be found.
- axisa single axis identifier (string,
- Returns
See also
- See Also:
-
The N-dimensional array (ndarray) (external Numpy documentation)