cf.Field.roll

Field.roll(axis, shift, inplace=False, i=False, **kwargs)[source]

Roll the field along a cyclic axis.

A unique axis is selected with the axes and kwargs parameters.

New in version 1.0.

Parameters
axis:

The cyclic axis to be rolled, defined by that which would be selected by passing the given axis description to a call of the field construct’s domain_axis method. For example, for a value of 'X', the domain axis construct returned by f.domain_axis('X') is selected.

shift: int

The number of places by which the selected cyclic axis is to be rolled.

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.

kwargs: deprecated at version 3.0.0

Returns
Field

The rolled field.

Examples

Roll the data of the “X” axis one elements to the right:

>>> f.roll('X', 1)

Roll the data of the “X” axis three elements to the left:

>>> f.roll('X', -3)