larray.Axis.extend

Axis.extend(self, labels)[source]

Append new labels to an axis or increase its length in case of wildcard axis. Note that extend does not occur in-place: a new axis object is allocated, filled and returned.

Parameters
labelsint, iterable or Axis

New labels to append to the axis. Passing directly another Axis is also possible. If the current axis is a wildcard axis, passing a length is enough.

Returns
Axis

A copy of the axis with new labels appended to it or with increased length (if wildcard).

Examples

>>> time = Axis([2007, 2008], 'time')
>>> time
Axis([2007, 2008], 'time')
>>> time.extend([2009, 2010])
Axis([2007, 2008, 2009, 2010], 'time')
>>> waxis = Axis(10, 'wildcard_axis')
>>> waxis
Axis(10, 'wildcard_axis')
>>> waxis.extend(5)
Axis(15, 'wildcard_axis')
>>> waxis.extend([11, 12, 13, 14])
Traceback (most recent call last):
...
ValueError: Axis to append must (not) be wildcard if self is (not) wildcard