import dascore as dc
import numpy as np
= dc.get_example_patch()
patch
# Create a patch with a length-1 dimension by selecting time slice
= patch.coords.get_array("time")
time_array = patch.select(time=(time_array[0], time_array[0]))
single_time
# Squeeze the length-1 time dimension
= single_time.squeeze(dim="time") squeezed
squeeze
squeeze(
self: Patch ,
dim = None,
)-> ‘PatchType’
Return a new object with len one dimensions flattened.
Parameters
Parameter | Description |
---|---|
dim |
Selects a subset of the length one dimensions. If a dimension is selected with length greater than one, an error is raised. If None, all length one dimensions are squeezed. |