Skip to content

Fix enclosed tessellation recovery for numerically degenerate Voronoi partitions#180

Merged
yu-ta-sato merged 1 commit into
c2g-dev:mainfrom
yu-ta-sato:fix/fix_etc_recovery
Jul 4, 2026
Merged

Fix enclosed tessellation recovery for numerically degenerate Voronoi partitions#180
yu-ta-sato merged 1 commit into
c2g-dev:mainfrom
yu-ta-sato:fix/fix_etc_recovery

Conversation

@yu-ta-sato

Copy link
Copy Markdown
Collaborator

Description

This PR changes the retry order for momepy.enclosed_tessellation failures so that TypeError from boundary simplification first retries with grid_size=1e-3, before falling back to simplify=False. The coarser grid size repairs the underlying partition in the observed real-data failure case, while simplify=False can allow degenerate overlapping cells to pass through.

It also adds validation for overfilled enclosures after tessellation generation. For each enclosure, the total cell area is checked against enclosure_area * 1.05. If cells exceed that tolerance, the tessellation is treated as degenerate:

  • retry once with grid_size=1e-3 when the caller has not pinned grid_size
  • drop persistently degenerate enclosure cells with a warning
  • preserve existing empty-tessellation handling for momepy failures

Regression coverage was added for:

  • TypeError retrying with grid_size=1e-3
  • fallback to simplify=False when the grid-size retry still fails
  • silent overlapping-cell degeneration being detected and repaired
  • persistently overlapping enclosure cells being dropped

Related Issues

N/A

Checklist

  • I have read the Contributing Guide.
  • I have updated the documentation, if necessary.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Pre-commit checks passed locally.

@yu-ta-sato yu-ta-sato merged commit 6732653 into c2g-dev:main Jul 4, 2026
6 checks passed
@yu-ta-sato yu-ta-sato deleted the fix/fix_etc_recovery branch July 4, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant