Skip to content

keep blocks ending with a period number when trimming trailing text - #545

Merged
wpbonelli merged 1 commit into
modflowpy:developfrom
wpbonelli:trailing-text-load
Nov 6, 2026
Merged

wpbonelli merged 1 commit into
modflowpy:developfrom
wpbonelli:trailing-text-load

Conversation

@wpbonelli

@wpbonelli wpbonelli commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Simulation.load could silently drop period blocks if there was any stray text afterwards. For example, in mf6/test/test021_twri, twri.rch has MF2005 lines left after its last period block.

  • Allow anything after END tags, as MF6 does
  • Warn when the trim drops text, naming the file and the lines: twri.rch: ignoring text after the last block (lines 11-13)

Text blocks used to lose data silently by the same route, and now raises. That's stricter than MF6, which skips it, but no longer silent. Consider whether to accept it like MF6 later

When a file failed to parse, the reader cut it back to the last block
_BLOCK_RE recognized and parsed again. The regex allowed one word after
END, so END PERIOD 1 didn't end a block: the trim removed every period
block and the second parse succeeded, silently losing the data. Allow
anything after END, as MF6 does.

Warn when the trim drops text, with the file and the lines. Update
test021_twri's snapshots, which recorded its RCHA without its recharge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wpbonelli wpbonelli added this to the MMP milestone Nov 5, 2026
@wpbonelli wpbonelli added the bug Something isn't working label Nov 5, 2026
@wpbonelli
wpbonelli merged commit 0c14036 into modflowpy:develop Nov 6, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant