cf.DimensionCoordinate.transpose¶

DimensionCoordinate.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.

Parameters: 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.

Examples:

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