order

function of dascore.proc.coords source

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

import dascore as dc
from dascore.examples import get_example_patch
patch = get_example_patch()
# Sub-select only a section of the distance and ensure order.
dist = patch.get_array("distance")
new_dist = dist[1:5][::-1]
patch_1 = patch.order(distance=new_dist)
# Get duplicate the first time row or column
patch_2 = patch.order(time=[0, 0, 0], samples=True)
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.