Roll

class of dascore.proc.basic
inherits from: PatchProcessor, DascoreBaseModel, pydantic.main.BaseModel
source

Roll(
    *args ,
    samples: bool = False,
    update_coord: bool = False,
    **kwargs ,
)-> None

Roll patch array elements along a given dimension.

Parameters

Parameter Description
patch input patch
samples If True, the roll is a number of samples; else in coordinate units.
update_coord if True, updates coord based on rolled amount
**kwargs specifies dimension and number of elements to roll

Examples

import dascore as dc
patch = dc.get_example_patch()

# roll time dimension 5 elements
rolled_patch = patch.roll(time=5, samples=True)

# roll distance dimension 30 meters(or units of distance in patch)
rolled_patch2 = patch.roll(distance=30, samples=False)

# roll time dimension 5 elements and update coordinates
rolled_patch3 = patch.roll(time=5, samples=True, update_coord=True)

Methods

Name Description
check Refuse a patch which does not carry what the operation needs.
get_metadata Return the rolled metadata and the shift in samples.
kernel Return the data rolled along the axis.
model_copy Copy the model, dropping cached values the update invalidates.
new Create new instance with some attributed updated.
roll Roll patch array elements along a given dimension.
reconcile Return metadata or a patch holding the final data; default as is.
run Run the operation: check, get_metadata, kernel, reconcile, record.