cf.DimensionCoordinate.log

DimensionCoordinate.log(*args, **kwargs)[source]

The logarithm of the data array.

By default the natural logarithm is taken, but any base may be specified.

See also

exp

Parameters
base: number, optional

The base of the logarithm. By default a natural logarithm is taken.

bounds: bool, optional

If False then do not alter any bounds. By default any bounds are also altered.

inplace: bool, optional

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

i: deprecated at version 3.0.0

Use the inplace parameter instead.

Returns
DimensionCoordinate or None

The construct with the logarithm of data values. If the operation was in-place then None is returned.

Examples

>>> f.data
<CF Data(1, 2): [[1, 2]]>
>>> f.log().data
<CF Data: [[0.0, 0.69314718056]] ln(re 1)>
>>> f.data
<CF Data(1, 2): [[1, 2]] 2>
>>> f.log().data
<CF Data(1, 2): [[0.0, 0.69314718056]] ln(re 2 1)>
>>> f.data
<CF Data(1, 2): [[1, 2]] kg s-1 m-2>
>>> f.log().data
<CF Data(1, 2): [[0.0, 0.69314718056]] ln(re 1 m-2.kg.s-1)>
>>> f.log(inplace=True)
>>> f.Units
<Units: >
>>> f.log()
ValueError: Can't take the logarithm to the base 2.718281828459045 of <Units: >