import dascore
pa = dascore.get_example_patch()
# Differentiate along time, mirroring the data at the edges.
time_edges = pa.sobel_filter("time")
# Pad the edges with a fixed value instead.
padded = pa.sobel_filter("time", mode="constant", cval=1)
# Chain calls to take the gradient along several dimensions.
sobel_time_space = pa.sobel_filter('time').sobel_filter('distance')SobelFilter
SobelFilter(
*args ,
dim: Any ,
mode: Any = reflect,
cval: Any = 0.0,
)-> None
Estimate the gradient along one dimension with a Sobel operator.
Parameters
| Parameter | Description |
|---|---|
| patch | The patch to filter |
| dim | The dimension along which to apply |
| mode |
Determines how the input array is extended when the filter overlaps with a border. |
| cval | Fill value when mode=“constant”. |
Note
The kernel smooths along every dimension, so any of them holding more than one segment raises; use fill_gaps or split_gaps first. One list of labels is filtered sample by sample, as an irregular axis.
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 filter along, once the arguments are checked. |
| halo | Return how far along an axis the kernel reads to fill a sample. |
| model_copy | Copy the model, dropping cached values the update invalidates. |
| new | Create new instance with some attributed updated. |
| numpy_kernel | Return the Sobel gradient along the axis. |
| sobel_filter | Estimate the gradient along one dimension with a Sobel operator. |
| reconcile | Return metadata or a patch holding the final data; default as is. |
| run | Run the operation: check, get_metadata, kernel, reconcile, record. |