cf.Data.tanh

Data.tanh(inplace=False)[source]

Take the hyperbolic tangent of the data element-wise.

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 the hyperbolic tangent of 90 degrees_east is 0.91715234, as is the hyperbolic tangent of 1.57079632 radians.

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

New in version 3.1.0.

See also

arctanh, sinh, cosh, tan, arctan2

Parameters
inplace: bool, optional

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

Returns

Data or None

Examples

>>> d.Units
<Units: degrees_north>
>>> print(d.array)
[[-90 0 90 --]]
>>> e = d.tanh()
>>> e.Units
<Units: 1>
>>> print(e.array)
[[-0.9171523356672744 0.0 0.9171523356672744 --]]
>>> d.Units
<Units: m s-1>
>>> print(d.array)
[[1 2 3 --]]
>>> d.tanh(inplace=True)
>>> d.Units
<Units: 1>
>>> print(d.array)
[[0.7615941559557649 0.9640275800758169 0.9950547536867305 --]]