v.flexure: fix crash and add fatal for empty input vector map#1747
Open
awickert wants to merge 3 commits into
Open
v.flexure: fix crash and add fatal for empty input vector map#1747awickert wants to merge 3 commits into
awickert wants to merge 3 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1745. Two bugs in the zero-load-point edge case:
get_points_xycrashed withIndexErrorwhen passed a vector map containing no points:np.array([], dtype=float)has shape(0,), socoords[:, 0]raisesIndexError: too many indices for array. Fixed by returning empty 1-D arrays directly when there are no rows.gs.fatalimmediately 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
v.flexuretestsuite: 15/15 tests pass (14 from v.flexure: update for gFlex v2.0.0; redesign interface; add testsuite #1745 +test_empty_inputadded here)🤖 Generated with Claude Code