cf.Data.func

Data.func(f, units=None, out=False, i=False, **kwargs)[source]

Apply an element-wise array operation to the data array in place.

Parameters:
f
: function

The function to be applied.

units : cf.Units, optional

out: bool, optional

i
: bool, optional

If True then update the data array in place. By default a new data array is created.

Returns:

None

Examples:
>>> print d.Units
<CF Units: radians>
>>> print d.array
[[ 0.          1.57079633]
 [ 3.14159265  4.71238898]]
>>> import numpy
>>> d.func(numpy.cos, i=True)
>>> print d.array
[[ 1.0  0.0]
 [-1.0  0.0]]