Commit a7c2399
authored
Fix three accuracy bugs in reproject resampling kernels (#1087)
* Add design spec for geotiff performance and memory controls
Covers dtype on read, compression_level on write, and VRT tiled
output from to_geotiff for streaming dask writes.
* Fix three accuracy bugs in reproject resampling kernels (#1086)
1. Nearest-neighbor: use floor(r + 0.5) instead of int(r + 0.5) to
round correctly for negative fractional pixel coordinates.
int() truncates toward zero, which maps [-1.0, -0.5) to pixel 0
instead of out-of-bounds.
2. Cubic: check real neighbor indices against source bounds instead of
clamping OOB indices to the edge pixel. Border replication masked
the OOB condition, preventing the bilinear fallback that GDAL uses
when the 4x4 stencil extends outside the source.
3. CuPy map_coordinates fallback: tighten the NaN contamination
threshold from 0.1 to 1e-6 so that small NaN weights from distant
cubic neighbors are caught, matching the native CUDA kernel behavior.
* Address code review: edge-case tests and threshold comment (#1086)
- Test nearest-neighbor at exact boundary r=-0.5
- Test cubic fallback at far (bottom-right) edge
- Comment the 1e-6 NaN threshold rationale1 parent 443ed78 commit a7c2399
2 files changed
+98
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
59 | 54 | | |
60 | 55 | | |
61 | 56 | | |
| |||
109 | 104 | | |
110 | 105 | | |
111 | 106 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
117 | 110 | | |
118 | 111 | | |
119 | 112 | | |
120 | 113 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
127 | 118 | | |
128 | 119 | | |
129 | 120 | | |
| |||
339 | 330 | | |
340 | 331 | | |
341 | 332 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
352 | 338 | | |
353 | 339 | | |
354 | 340 | | |
| |||
453 | 439 | | |
454 | 440 | | |
455 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
456 | 447 | | |
457 | 448 | | |
458 | 449 | | |
| |||
844 | 835 | | |
845 | 836 | | |
846 | 837 | | |
847 | | - | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
848 | 842 | | |
849 | 843 | | |
850 | 844 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
198 | 270 | | |
199 | 271 | | |
200 | 272 | | |
| |||
0 commit comments