Return new fields with dimensions collapsed by statistical operations.
In all cases, the presence of missing data in an input field’s data array is accounted for during the collapse.
The following collapse methods are available over any subset of the fields’ dimensions, where the methods are defined exactly as for CF cell methods:
Method | Description | Options |
---|---|---|
min | Minima over the specified dimensions | |
max | Maxima over the specified dimensions | |
mid_range | Means of the minima and maxima over the specified dimensions | |
mean | Means over the specified dimensions | Weighted or unweighted |
sum | Sums over the specified dimensions | Weighted or unweighted |
standard_deviation | Standard deviations over the specified dimensions | Weighted or unweighted, biased or unbiased |
variance | Variances over the specified dimensions | Weighted or unweighted, biased or unbiased |
Parameters : |
|
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns : |
|
Examples
>>> g = cf.collapse(f, 'max')
>>> g = cf.collapse(f, 'min', axes=[2, 1])
>>> g = cf.collapse(f, 'sum', axes='dim2')
>>> g = cf.collapse(f, 'mid_range', axes=('latitude', 0, dim2'))>>>
g = cf.collapse(f, 'mean', axes='latitude', weights=None)
>>> g = cf.collapse(f, 'mean', axes='longitude', weights=None)
>>> g = cf.collapse(f, 'mean', axes=['longitude', 'latitude'], weights=None)
>>> g = cf.collapse(f, 'standard_deviation', weights=None)
>>> g = cf.collapse(f, 'variance', weights=None, unbiased=True)
>>> g = cf.collapse(f, 'mean', axes='latitude')
>>> g = cf.collapse(f, 'mean', axes='longitude')
>>> g = cf.collapse(f, 'mean', axes=['longitude', 'latitude'])
>>> g = cf.collapse(f, 'variance')
>>> g = cf.collapse(f, 'standard_deviation', unbiased=True)
>>> g = cf.collapse(f, 'longitude: mean latitude: max')