cf.FieldAncillary.cos

FieldAncillary.cos(bounds=True, i=False)[source]

Take the trigonometric cosine of the data array.

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

The output units are ‘1’ (nondimensionsal).

See also

sin, tan

Examples 1:
>>> g = f.cos()
Parameters:
bounds: optional

Ignored.

i: bool, optional

If True then update the field ancillary in place. By default a new field ancillary is created. In either case, a field ancillary is returned.

Returns:
out: cf.FieldAncillary

The field ancillary with the cosine of data array values.

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