cf.collapse

cf.collapse(fields, method, axes=None, weights='default', unbiased=False, ignore_size1=True, squeeze=False)

Collapse fields’ dimensions.

Parameters :
fields : (sequence of) Field or FieldList

The field or fields to be collapsed.

method : str or CellMethods

There are two ways of setting the collapse method:

  • A string containing a single method (such as ‘min’).

    All of the dimensions specified with the axes parameter are collapsed simultaneously with this method.

  • A CF cell methods string (such as ‘time: max’) or a CellMethods object equivalent to such a string.

    This method specifies both collapse methods and the axes to apply them to. Each name in the string is interpreted as for the axes parameter. Multiple cell methods may be specified (such as ‘time: max height: mean’), in which case each collapse is carried out independently and in the order that they are given.

  • A sequence of method strings (such as [‘mid_range’, ‘variance’])

axes : scalar or sequence, optional

weights : str or None or dict, optional

unbiased : bool, optional

If True then the calculate unbiased statisics where applicable. By default biased statistics are calculated.

ignore_size1 : bool, optional

If False then raise a ValueError if a dimension to be collapsed has size 1, regardless of whether or not it spans the data array. By default size 1 collapse dimensions are ignored, regardless of whether or not they span the data array.

squeeze : bool, optional

If True then remove collapsed dimensions from the data array. By default collapsed dimensions are retained with size 1 if they were spanned by the original data array.

Returns :

out : Field or FieldList

Examples

Previous topic

cf.aggregate

Next topic

cf.equals

This Page