import dascore as dc
import numpy as np
patch = dc.get_example_patch()
# Flip patch over time axis
out = patch.flip("time")
assert np.all(patch.get_array("time") == out.get_array("time")[::-1])
# Flip patch over all dimensions.
out = patch.flip(*patch.dims)flip
flip(
patch ,
*dims ,
flip_coords = True,
)
Flip patch data and (optionally coords) along specified dimensions.
Parameters
| Parameter | Description |
|---|---|
| patch | The patch to flip. |
| *dims | The dimensions over which to flip (mirror). |
| flip_coords |
If True, also flip coords associated with dimensions, otherwise leave them unchanged. |