cfdm.DomainAncillary.squeeze¶
-
DomainAncillary.
squeeze
(*args, **kwargs)[source]¶ Remove size one axes from the data array.
By default all size one axes are removed, but particular size one axes may be selected for removal. Corresponding axes are also removed from the bounds data array, if present.
New in version (cfdm): 1.7.0
See also
- Parameters
- axes: (sequence of)
int
, optional The positions of the size one axes to be removed. By default all size one axes are removed.
Each axis is identified by its integer position in the data. Negative integers counting from the last position are allowed.
- Parameter example:
axes=0
- Parameter example:
axes=-1
- Parameter example:
axes=[1, -2]
- inplace:
bool
, optional If True then do the operation in-place and return
None
.
- axes: (sequence of)
- Returns
DomainAncillary
orNone
The new construct with removed data axes. If the operation was in-place then
None
is returned.
Examples
>>> f.shape (1, 73, 1, 96) >>> f.squeeze().shape (73, 96) >>> f.squeeze(0).shape (73, 1, 96) >>> g = f.squeeze([-3, 2]) >>> g.shape (73, 96) >>> f.bounds.shape (1, 73, 1, 96, 4) >>> g.shape (73, 96, 4)