cf.Data.sum_of_squares

Data.sum_of_squares(axes=None, squeeze=False, mtol=1, weights=None, inplace=False, _preserve_partitions=False)[source]

Collapse axes with the sum of the squares of the values.

Missing data array elements are omitted from the calculation.

Parameters

axes : (sequence of) int, optional

squeeze : bool, optional

inplace: bool, optional

If True then do the operation in-place and return None.

Returns
Data or None

The collapsed data, or None if the operation was in-place.

Examples:

>>> d = cf.Data([[-1, 2, 3], [9, -8, -12]], 'm')
>>> d.sum_of_squares()
<CF Data(1, 1): [[303]] m2>
>>> d.sum_of_squares(axes=1)
<CF Data(2, 1): [[14, 289]] m2>