Skip to content

v.flexure: fix crash and add fatal for empty input vector map#1747

Open
awickert wants to merge 3 commits into
OSGeo:grass8from
awickert:fix/v-flexure-empty-input
Open

v.flexure: fix crash and add fatal for empty input vector map#1747
awickert wants to merge 3 commits into
OSGeo:grass8from
awickert:fix/v-flexure-empty-input

Conversation

@awickert

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1745. Two bugs in the zero-load-point edge case:

  • get_points_xy crashed with IndexError when passed a vector map containing no points: np.array([], dtype=float) has shape (0,), so coords[:, 0] raises IndexError: too many indices for array. Fixed by returning empty 1-D arrays directly when there are no rows.
  • A zero-point input would have silently produced all-zero deflection (gFlex treats it as no load, which is mathematically correct but almost certainly a user error). Added a gs.fatal immediately after coordinate loading so the user gets a clear message rather than a flat raster with no warning.

Note: the summary in #1745 incorrectly claimed "validates minimum of 2 load points" — that check was never implemented, and the claim was a hallucination in the AI-generated PR description. The minimum is 1 point (a single-point load works correctly and is the primary test fixture). This PR adds the zero-point guard only.

Test plan

🤖 Generated with Claude Code

awickert and others added 3 commits June 10, 2026 10:13
np.array([], dtype=float) has shape (0,), so coords[:, 0] raises
IndexError. Return empty 1-D arrays directly when the map has no rows.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
A zero-point input produces all-zero deflection in gFlex (mathematically
correct) but is almost certainly a user error. Fail early with a clear
GRASS-idiomatic message rather than silently producing a flat output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers the gs.fatal guard added for a zero-point input vector map.
Uses v.edit tool=create to produce an empty map fixture.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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