cf.Field.cyclic

Field.cyclic(axes=None, iscyclic=True, period=None, **kwargs)[source]

Set the cyclicity of an axis.

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

New in version 1.0.

int

Examples 1:
>>> s = f.cyclic('X', period=360)
Parameters:
axes, kwargs: optional

Select axes. The axes parameter may be one, or a sequence, of:

  • None. If no kwargs arguments have been set then all axes are selected. This is the default.
  • An integer. Explicitly selects the axis corresponding to the given position in the list of axes of the field’s data array.

    Example:

    To select the third data array axis: axes=2. To select the last axis: axes=-1.

  • A slice object. Explicitly selects the axes corresponding to the given positions in the list of axes of the field’s data array.

    Example:

    To select the last three data array axes: axes=slice(-3, None)

  • A domain axis identifier. Explicitly selects this axis.

    Example:

    To select axis “dim1”: axes='dim1'.

  • Any value accepted by the description parameter of the field’s items method. Used in conjunction with the kwargs parameters to select the axes which span the items that would be identified by this call of the field’s items method: f.items(items=axes, axes=None, **kwargs). See cf.Field.items for details.

    Example:

    To select the axes spanned by one dimensionsal time coordinates: f.cyclic('T', ndim=1).

If axes is a sequence of any combination of the above then the selected axes are the union of those selected by each element of the sequence. If the sequence is empty then no axes are selected.

iscyclic: bool, optional

If False then the axis is set to be non-cyclic. By default the selected axis is set to be cyclic.

period: data-like object, optional

The period for a dimension coordinate object which spans the selected axis. The absolute value of period is used. If period has units then they must be compatible with those of the dimension coordinates, otherwise it is assumed to have the same units as the dimension coordinates.

A data-like object is any object containing array-like or scalar data which could be used to create a cf.Data object.

Example:

Instances, x, of following types are all examples of data-like objects (because cf.Data(x) creates a valid cf.Data object): int, float, str, tuple, list, numpy.ndarray, cf.Data, cf.Coordinate, cf.Field.

Returns:
out: set

The axes of the field which were cyclic prior to the new setting, or the current cyclic axes if no axis was specified.

Examples:
>>> f.axes('X', key=True)
{'dim3': <CF DomainAxis: 192>}
>>> f.cyclic()
{}
>>> f.cyclic('X', period=360)
{}
>>> f.cyclic()
{'dim3'}
>>> f.cyclic('X', False)
{'dim3'}
>>> f.cyclic()
{}
>>> f.cyclic('longitude', period=360, exact=True)
{}
>>> f.cyclic()
{'dim3'}
>>> f.cyclic('dim3', False)
{'dim3'}
>>> f.cyclic()
{}