cf.Field.derivative

Field.derivative(axis, cyclic=None, one_sided_at_boundary=False, i=False)[source]

Return the centred finite difference along the specified axis.

If the axis is cyclic then the boundary is wrapped around, otherwise missing values are used at the boundary unless one-sided finite differences are requested.

Parameters:
axes: optional

Select items which span at least one of the specified axes, taken in any order, and possibly others. Axes are defined by identfiying items of the field (such as dimension coordinate objects) or by specifying axis sizes. In the former case the selected axes are those which span the identified items. The axes are interpreted as those that would be returned by the field’s axes method, i.e. by f.axes(axes) or, if axes is a dictionary, f.axes(**axes). See cf.Field.axes for details.

Example:

To select items which span a time axis, and possibly others, you could set: axes='T'.

Example:

To select items which span a latitude and/or longitude axes, and possibly others, you could set: axes=['X', 'Y'].

Example:

To specify axes with size 19 you could set axes={'size': 19}. To specify depth axes with size 40 or more, you could set: axes={'axes': 'depth', 'size': cf.ge(40)} (see cf.ge).

cyclic: bool, optional

If True then the boundary is wrapped around, otherwise the value of one_sided_at_boundary determines the boundary condition. If None then the cyclicity of the axis is autodetected.

one_sided_at_boundary: bool, optional

If True then one-sided finite differences are used at the boundary, otherwise missing values are used.

i: bool, optional

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

Returns:

out: cf.Field