Commit 12855fe
authored
* Validate kernel and DataArray inputs to convolution entry points
convolve_2d checked the raster but never the kernel. A None, 1D, 3D, or
list kernel reached the numba kernel and raised a TypingError that named
nothing the user controls. An even-sided kernel was accepted and produced
a silently off-center result, even though custom_kernel already rejects
even kernels.
Add _validate_kernel (2D, odd side lengths, duck-typed on ndim/shape so
numpy and cupy kernels both pass) and call it in convolve_2d. Also call
_validate_raster in convolution_2d so a non-DataArray agg raises a clear
TypeError instead of "'memoryview' object has no attribute 'astype'".
Internal callers (focal, edge_detection, emerging_hotspots) all pass odd
2D arrays, so they are unaffected.
* sweep(error-handling): record convolution audit state
1 parent f1f81b8 commit 12855fe
3 files changed
Lines changed: 80 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
375 | 403 | | |
376 | 404 | | |
377 | 405 | | |
| |||
558 | 586 | | |
559 | 587 | | |
560 | 588 | | |
| 589 | + | |
561 | 590 | | |
562 | 591 | | |
563 | 592 | | |
| |||
699 | 728 | | |
700 | 729 | | |
701 | 730 | | |
| 731 | + | |
702 | 732 | | |
703 | 733 | | |
704 | 734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
89 | 134 | | |
90 | 135 | | |
91 | 136 | | |
| |||
0 commit comments