cfdm.DomainAncillary.insert_dimension¶

DomainAncillary.
insert_dimension
(*args, **kwargs)[source]¶ Expand the shape of the data array.
Inserts a new size 1 axis into the data array. A corresponding axis is also inserted into the bounds data array, if present.
New in version (cfdm): 1.7.0
 Parameters
 position:
int
, optional Specify the position that the new axis will have in the data array. By default the new axis has position 0, the slowest varying position. Negative integers counting from the last position are allowed.
 Parameter example:
position=2
 Parameter example:
position=1
 inplace:
bool
, optional If True then do the operation inplace and return
None
.
 position:
 Returns
DomainAncillary
orNone
The new construct with expanded data axes. If the operation was inplace then
None
is returned.
Examples
>>> f.shape (19, 73, 96) >>> f.insert_dimension(position=3).shape (96, 73, 19, 1) >>> g = f.insert_dimension(position=1) >>> g.shape (19, 73, 1, 96) >>> f.bounds.shape (19, 73, 96, 4) >>> g.bounds.shape (19, 73, 1, 96, 4)