DomainAncillary.transpose(axes=None, inplace=False)[source]

Permute the axes of the data array.

Corresponding axes of the bounds data array, if present, are also permuted.

Note that if i) the data array is two-dimensional, ii) the two axes have been permuted, and iii) each cell has four bounds values; then columns 1 and 3 (counting from 0) of the bounds axis are swapped to preserve contiguity bounds in adjacent cells. See section 7.1 “Cell Boundaries” of the CF conventions for details.

axes: (sequence of) int

The new axis order. By default the order is reversed. Each axis in the new order is identified by its original integer position. Negative integers counting from the last position are allowed.

Parameter example:

axes=[2, 0, 1]

Parameter example:

axes=[-1, 0, 1]

inplace: bool, optional

If True then do the operation in-place and return None.


The new construct with permuted data axes. If the operation was in-place then None is returned.


(19, 73, 96)
>>> f.tranpose().data.shape
(96, 73, 19)
>>> g = f.tranpose([1, 0, 2])
(73, 19, 96)
(19, 73, 96, 4)
(73, 19, 96, 4)