import dascore as dc
from dascore.examples import get_example_patch
= get_example_patch()
patch # Sub-select only a section of the distance and ensure order.
= patch.get_array("distance")
dist = dist[1:5][::-1]
new_dist = patch.order(distance=new_dist)
patch_1 # Get duplicate the first time row or column
= patch.order(time=[0, 0, 0], samples=True) patch_2
order
order(
patch: Patch ,
copy = False,
relative = False,
samples = False,
**kwargs ,
)-> ‘PatchType’
Re-order the patch contents based on coordinate values or indices.
Parameters
Parameter | Description |
---|---|
patch | The patch object. |
copy |
If True, copy the resulting data. This is needed so the old array can get gc’ed and memory freed. |
relative | If True, order values are relative to the start/end of the coordinates. |
samples | If True, the |
**kwargs |
Used to specify the coordinate and values on which the coordinates are ordered. |
Examples
Note
- This function is similar to
Patch.select
but it will also change the patch order to match the inputs exactly. If there are repeated values in the requsted values or in the patch coordinate arrays, the data will end up being repeated as well.