import dascore
pa = dascore.get_example_patch()
# Subtract the best-fitting line from each channel.
out = pa.detrend("time")
# Or only the mean.
demeaned = pa.detrend("time", type="constant")Detrend
Detrend(
*args ,
dim: str ,
type: Literal[‘linear’, ‘constant’] = linear,
)-> None
Remove a constant or linear trend from the data along one dimension.
Parameters
| Parameter | Description |
|---|---|
| patch | The patch to detrend. |
| dim | Name of the dimension to detrend along. |
| type |
The trend to subtract: “linear” (the default) removes a least-squares line, “constant” removes the mean. |
Examples
Methods
| Name | Description |
|---|---|
| check | Refuse a patch which does not carry what the operation needs. |
| chunk_contract | Return what a chunk of the output needs of the input, or None. |
| get_metadata | Return the axis to detrend along. |
| model_copy | Copy the model, dropping cached values the update invalidates. |
| new | Create new instance with some attributed updated. |
| numpy_kernel | Return the data with the trend along the axis removed. |
| detrend | Remove a constant or linear trend from the data along one dimension. |
| reconcile | Return metadata or a patch holding the final data; default as is. |
| run | Run the operation: check, get_metadata, kernel, reconcile, record. |