cf.Field.anchor

Field.anchor(axis, value, i=False, _dry_run=False, **kwargs)[source]

Roll a cyclic axis so that the given value lies in the first coordinate cell.

New in version 1.0.

See also

axis, cyclic, iscyclic, period, roll

Parameters:
axis, kwargs : optional

Select the unique axis which would be selected by this call of the field’s axes method: f.axes(axis, **kwargs). See cf.Field.axes for details.

value : data-like

Anchor the dimension coordinate values for the selected cyclic axis to this value. The coordinate values are transformed so that value is “equal to or just before” the new first coordinate value. More specifically:

  • Increasing dimension coordinates with positive period, P, are transformed so that value lies in the half-open range (L-P, F], where F and L are the new first and last coordinate values, respectively.
  • Decreasing dimension coordinates with positive period, P, are transformed so that value lies in the half-open range (L+P, F], where F and L are the new first and last coordinate values, respectively.
i : bool, optional

If True then update the field in place. By default a new field is created.

_dry_run : bool, optional

Return a dictionary of parameters which describe the anchoring process. The field is not changed, even if i is True.

Returns:

out : cf.Field

Examples:
>>>

Previous topic

cf.Field.allclose

Next topic

cf.Field.asdatetime

This Page