Open zroy-wc opened 1 year ago
Note: I have a branch in my personal fork that is passing the tests run with the following.
pytest -v -n auto -m "not slow and not example and not regression"
I plan on running the full test suite if the proposition seems fine, and create a pull request at that point.
Thanks for this @zroy-wc and apologies for the long delay. Your suggestion seems good to me, with the caveat that in #1915 it is proposed to deprecate and eventually remove flopy.utils.reference
, so I think ModelTime
would be the place for this. Maybe others have thoughts or are aware of complications I am not.
flopy 3.3.5
python 3.10.5
Model grid geographic reference information can be loaded from files. No such option exists for model temporal reference information.
Current Behavior
Default behavior for
flopy.discretization.Grid
classes is to read from the following references in order:The
.modflow.Modflow
class creates.discretization.ModelTime
and (sub-classes of).discretization.Grid
objects for it'smodeltime
andmodelgrid
attributes (respectively).The
ModelTime
object does not support reading from the above references like it'sGrid
counterpart does. Additionally, the.utils.reference.TemporalReference
does not support reading from file either.Existing behavior for reading temporal information exists in the
Grid
class in it'sread_usgs_model_reference_file
andattribs_from_namfile_header
methods. Currently, temporal information is not used. Moving these methods to.utils.reference
, and adjusting them to be functions that returndict
could allow their use in theModelTime
class as well.Proposed Change
read_usgs_model_reference_file
andread_attribs_from_namfile_header
in.utils.reference
. Use the following signatures.def read_usgs_model_reference_file(reffile: str="usgs.model.reference") -> dict:
def read_attribs_from_namfile_header(namefile: str)-> dict:
.discretization.Grid
. Adjust these methods to use the.utils.referece
functions created above. Changes would be made oread_usgs_model_reference_file
andattribs_from_namfile_header
methods..discretization.ModelTime
class to mirror the API for theGrid
class.Files changed would be:
flopy/discretization/grid.py
flopy/discretization/modeltime.py
flopy/utils/reference.py
Let me know if you see any complications here that I am ignorant to. If there are none seen, I can submit a pull request.
Cheers
Minimum Reproducible Example Files