cf.Field.period

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

Return the period of an axis.

Note that a non-cyclic axis may have a defined period.

New in version 1.0.

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 items 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.period('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.

Returns:
out : cf.Data or None

The period of the cyclic axis’s dimension coordinates, or None no period has been set.

Examples 2:
>>> f.cyclic()
{}
>>> print f.period('X')
None
>>> f.dim('X').Units
<CF Units: degrees_east>
>>> f.cyclic('X', period=360)
{}
>>> print f.period('X')
<CF Data: 360.0 'degrees_east'>
>>> f.cyclic('X', False)
{'dim3'}
>>> print f.period('X')
<CF Data: 360.0 'degrees_east'>
>>> f.dim('X').period(None)
<CF Data: 360.0 'degrees_east'>
>>> print f.period('X')
None

Previous topic

cf.Field.items_axes

Next topic

cf.Field.remove_axes

This Page