refactor: consolidate component/data model#97
Draft
wpbonelli wants to merge 8 commits into
Draft
Conversation
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.
The base classes
ListPackage,ArrayPackage,ScalarPackage,AdvancedPackageall 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
Packageclass 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
Packageto the old subclass names for some backwards-compatibility.Specific fixes/changes:
__repr__for simulations with exchangesget_exchange()ats_activeby deriving from package statesolutionproperty to correctly return the first solutiondiversionsa 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 correctedSfrPackagealiasvariable_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 informativenboundandmaxbound, returning None where not applicable; previously only supported on packages classified as "list packages", failed withAttributeErrorfor others