cf.FieldList.log

FieldList.log(base=10, i=False)

For each field, the logarithm of the data array.

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

See also

exp

Examples 1:
>>> g = f.log()
Parameters:
base : number, optional

The base of the logiarthm. By default a natural logiarithm is taken.

i : bool, optional

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

Returns:
out : cf.FieldList

For each field, the field list with the logarithm of data array values.

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