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 missing samples (holes in a step) in any of them raise; use split_gaps or fill_gaps first.
Examples
Methods
| Name | Description |
|---|---|
| check | Refuse a patch which does not carry what the operation needs. |
| get_metadata | Return the axis to filter along, once the arguments are checked. |
| 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. |