Skip to content

refactor: consolidate component/data model#97

Closed
wpbonelli wants to merge 8 commits into
MODFLOW-ORG:developfrom
wpbonelli:refactor
Closed

refactor: consolidate component/data model#97
wpbonelli wants to merge 8 commits into
MODFLOW-ORG:developfrom
wpbonelli:refactor

Conversation

@wpbonelli

@wpbonelli wpbonelli commented Jun 24, 2026

Copy link
Copy Markdown
Member

The base classes ListPackage, ArrayPackage, ScalarPackage, AdvancedPackage all represent mutually exclusive containers for a single type of variable. Every package was classified as exactly one, the classification determining what data it could expose. But MF6 components are composites of the different variable types.

Consolidate these classes into a single Package class which consists of a collection of variables. Remove the intermediate base classes and all the concrete subclasses (SfrPackage, LakPackage, MawPackage, UzfPackage, etc.) and the package factory mechanism.

This PR aims for minimal breakage; alias Package to the old subclass names for some backwards-compatibility.

Specific fixes/changes:

  • fix __repr__ for simulations with exchanges
  • fix memory address construction for exchanges
  • fix exchange name iteration in get_exchange()
  • avoid stale ats_active by deriving from package state
  • fix solution property to correctly return the first solution
  • Make SFR diversions a dynamic attribute instead of a property (which didn't work correctly before, it'd always return empty)
  • SfrPakage (old misspelling) is kept as an alias alongside a corrected SfrPackage alias
  • fix variable_names, packages like WEL or DRN previously returned [] since list variables are stored separately from scalars/arrays; now includes list names (stress_period_data, packagedata, etc.) so all package types return something informative
  • support nbound and maxbound, returning None where not applicable; previously only supported on packages classified as "list packages", failed with AttributeError for others
  • fix exchange package address format (two-level GWF-GWF_1/NEXG rather than three-level)

@wpbonelli wpbonelli added this to the 0.3.0 milestone Jun 30, 2026
@wpbonelli wpbonelli added the refactor Non-functional changes label Jun 30, 2026
@wpbonelli

Copy link
Copy Markdown
Member Author

this should be split up, some of the substantial refactoring probably best to move to a separate branch for 3.x that can evolve independently

@wpbonelli wpbonelli closed this Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Non-functional changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant