Commit 7c2e09d
fix(geospatial): fix VertexGrid layer search and boundary point handling
Fixes two critical issues in GeospatialIndex:
1. VertexGrid layer search: Was always returning layer 0. Now properly
searches through all layers using zv[lay, icell2d] for top and
zv[lay+1, icell2d] for bottom elevations.
2. Boundary point handling: Points exactly on shared vertices/edges
could match multiple cells. Implemented max(matching_cells) tiebreaker
to match searchsorted() behavior with side="right" for consistency.
Performance impact: Checks up to 5 candidates instead of returning first
match, adding minimal overhead while ensuring correctness for edge cases.
Fixes:
- test_vertex_xyz_intersect (layer 0 vs layer 2 mismatch)
- test_intersection (cell 267 vs 268 boundary point)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 0fffdeb commit 7c2e09d
1 file changed
+34
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
391 | 394 | | |
392 | 395 | | |
393 | 396 | | |
394 | 397 | | |
395 | 398 | | |
396 | | - | |
397 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
398 | 403 | | |
399 | 404 | | |
400 | 405 | | |
401 | | - | |
| 406 | + | |
402 | 407 | | |
403 | | - | |
404 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
405 | 412 | | |
406 | 413 | | |
407 | 414 | | |
408 | 415 | | |
409 | | - | |
410 | | - | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
411 | 425 | | |
412 | 426 | | |
413 | 427 | | |
| |||
554 | 568 | | |
555 | 569 | | |
556 | 570 | | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
571 | 584 | | |
572 | 585 | | |
573 | 586 | | |
| |||
0 commit comments