Skip to content

make period_states independent of object model - #554

Merged
wpbonelli merged 2 commits into
modflowpy:developfrom
wpbonelli:period-states-blocks
Nov 20, 2026
Merged

wpbonelli merged 2 commits into
modflowpy:developfrom
wpbonelli:period-states-blocks

Conversation

@wpbonelli

Copy link
Copy Markdown
Member

Tentative, pending discussion with @mjreno. Follow-up to #552.

  • period_state.period_states(blocks, mode, nper, shapes, active, index) takes {kper: {tag: value}} only, so it doesn't depend on the object model.
  • New Package.period_states() builds the blocks through _period_dict. The NetCDF export and Package.period_array(fill_forward=True) both call it, so there is one implementation of MF6's period regimes.
  • Behaviour change: period_array on grid packages now follows MF6's grid regime. For example, an empty block clears aux as well. Time-array series still raise there.

🤖 Generated with Claude Code

period_state.period_states(blocks, mode, nper, shapes, active, index) works on
{kper: {tag: value}} alone. Package.period_states builds the blocks (via
_period_dict) and the NetCDF export and period_array(fill_forward=True) both
go through it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wpbonelli wpbonelli added this to the MMP milestone Nov 19, 2026
@mjreno

mjreno commented Nov 20, 2026

Copy link
Copy Markdown
Contributor
  • The clear "period shape isn't known" error is gone. Package.period_states now skips a field it can't size, and the export then fails later with a KeyError. Suggest raising in the export path, as before.
  • The parity test only runs where an extended mf6 ≥ 6.9 (includes current develop) is on PATH, so it doesn't run in flopy4's CI on Linux and macOS. This refactor was checked locally.

Package.period_states skipped a field it couldn't size, so the export
failed later with a KeyError. Raise the old "period shape isn't known"
error for a field asked for or given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wpbonelli

Copy link
Copy Markdown
Member Author

The clear "period shape isn't known" error is gone. Package.period_states now skips a field it can't size, and the export then fails later with a KeyError. Suggest raising in the export path, as before.

Good point, done

@wpbonelli
wpbonelli marked this pull request as ready for review November 20, 2026 14:40
@wpbonelli wpbonelli changed the title period_states takes period blocks, not a Package make period_states independent of object model Nov 20, 2026
@wpbonelli
wpbonelli merged commit 5bdb5bb into modflowpy:develop Nov 20, 2026
17 of 18 checks passed
@wpbonelli
wpbonelli deleted the period-states-blocks branch November 20, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants