cf.Data.cos

Data.cos(inplace=False, i=False)[source]

Take the trigonometric cosine of the data array in place.

Units are accounted for in the calculation. If the units are not equivalent to radians (such as Kelvin) then they are treated as if they were radians. For example, the cosine of 90 degrees_east is 0.0, as is the cosine of 1.57079632 kg m-2.

The output units are changed to ‘1’ (nondimensional).

Parameters
inplace: bool, optional

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

i: deprecated at version 3.0.0

Use inplace parameter instead.

Returns

Data or None

Examples:

>>> d.Units
<Units: degrees_east>
>>> print(d.array)
[[-90 0 90 --]]
>>> d.cos()
>>> d.Units
<Units: 1>
>>> print(d.array)
[[0.0 1.0 0.0 --]]
>>> d.Units
<Units: m s-1>
>>> print(d.array)
[[1 2 3 --]]
>>> d.cos()
>>> d.Units
<Units: 1>
>>> print9d.array)
[[0.540302305868 -0.416146836547 -0.9899924966 --]]