Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: mf6 package name alters behavior with flopy #2118

Closed
mwtoews opened this issue Mar 2, 2024 · 1 comment
Closed

bug: mf6 package name alters behavior with flopy #2118

mwtoews opened this issue Mar 2, 2024 · 1 comment
Assignees
Labels
Milestone

Comments

@mwtoews
Copy link
Contributor

mwtoews commented Mar 2, 2024

A short version of the bug is demonstrated with:

import flopy

sim = flopy.mf6.MFSimulation()
tdis = flopy.mf6.ModflowTdis(sim)
gwf = flopy.mf6.ModflowGwf(sim)
print(f"{hasattr(gwf, 'sto')=}, {hasattr(gwf, 'modeltime')=}")
flopy.mf6.ModflowGwfdrn(gwf, pname="storm")
print(f"{hasattr(gwf, 'sto')=}, {hasattr(gwf, 'modeltime')=}")

showing the output before and after adding a troubling package name:

hasattr(gwf, 'sto')=False, hasattr(gwf, 'modeltime')=True
hasattr(gwf, 'sto')=True, hasattr(gwf, 'modeltime')=False

The issue is caused by the user-defined package name pname="storm", which raises this error:

gwf.modeltime
# AttributeError: modeltime

note that modeltime is a property that is expected to be available.

Changing pname to other values, like pname="strm" allows normal operation. The package name should not influence the behavior of flopy. It seems that flopy might have confused "storm" with an unrelated and unused "sto" package.

Observed with Windows and Linux. Flopy version 3.7.0.dev0 (current development), and with several other older releases back to flopy-3.4.3 (i.e. this isn't new). This not an issue with the mf6 executable.

@mwtoews mwtoews added the bug label Mar 2, 2024
@wpbonelli wpbonelli added this to the 3.6.1 milestone Mar 2, 2024
spaulins-usgs added a commit that referenced this issue Mar 20, 2024
* fix(get_package and model_time): #2117, #2118

get_package now allows you to get package only by name or type, instead of always searching for a package both by name and type

model_time displays the correct steady state array and no longer gets confused if packages are named similar to the package type it is searching for

* fix(resolve merge conflict)

---------

Co-authored-by: scottrp <45947939+scottrp@users.noreply.github.com>
@spaulins-usgs
Copy link
Contributor

A fix has been checked in to the develop branch for this issue.

@wpbonelli wpbonelli modified the milestones: 3.6.1, 3.7.0 May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants