cf.DomainAncillary.transpose¶
-
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.
See also
- 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
.
- axes: (sequence of)
- Returns
The new construct with permuted data axes. If the operation was in-place then
None
is returned.
Examples:
>>> f.shape (19, 73, 96) >>> f.tranpose().shape (96, 73, 19) >>> g = f.tranpose([1, 0, 2]) >>> g.shape (73, 19, 96) >>> f.bounds.shape (19, 73, 96, 4) >>> g.bounds.shape (73, 19, 96, 4)