cf.Data.func¶
-
Data.
func
(f, units=None, out=False, i=False, **kwargs)[source]¶ Apply an element-wise array operation to the data array.
Parameters: - f:
function
The function to be applied.
units:
cf.Units
, optionalout:
bool
, optional- i:
bool
, optional If True then update the data array in place. By default a new data array is created.
Returns: out:
cf.Data
Examples: >>> d.Units <CF Units: radians> >>> print d.array [[ 0. 1.57079633] [ 3.14159265 4.71238898]] >>> import numpy >>> e = d.func(numpy.cos) >>> e.Units <CF Units: 1> >>> print e.array [[ 1.0 0.0] [-1.0 0.0]] >>> d.func(numpy.sin, i=True) >>> print d.array [[0.0 1.0] [0.0 -1.0]]
- f: