You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The .modflow.Modflow class creates .discretization.ModelTime and (sub-classes of) .discretization.Grid objects for it's modeltime and modelgrid attributes (respectively).
The ModelTime object does not support reading from the above references like it's Grid 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's read_usgs_model_reference_file and attribs_from_namfile_header methods. Currently, temporal information is not used. Moving these methods to .utils.reference, and adjusting them to be functions that return dict could allow their use in the ModelTime class as well.
Proposed Change
Create 2 functions, read_usgs_model_reference_file and read_attribs_from_namfile_header in .utils.reference. Use the following signatures.
Alter 2 existing methods in .discretization.Grid. Adjust these methods to use the .utils.referece functions created above. Changes would be made o read_usgs_model_reference_file and attribs_from_namfile_header methods.
Add 2 methods in .discretization.ModelTime class to mirror the API for the Grid 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
example.nam
# Name file for MODFLOW-NWT, generated by Flopy version 3.3.5.
LIST 2 example.list
DIS 11 example.dis
example.dis
# DIS package for MODFLOW-NWT generated by Flopy 3.3.5
1 1 1 5 4 2
0
CONSTANT 1.000000E+00 #delr
CONSTANT 1.000000E+00 #delc
CONSTANT 1.000000E+00 #model_top
CONSTANT 0.000000E+00 #botm layer 1
1.000000 1 1.000000 SS
1.000000 1 1.000000 SS
1.000000 1 1.000000 SS
1.000000 1 1.000000 SS
1.000000 1 1.000000 SS
usgs.model.reference
# Hypothetical, non-zero for demonstration
xul 2.022
yul 3.14
rotation 42
# Set non-typical
time_units days
start_date 1/1/2000
start_time 00:00:00
read_example.py
import flopy
model = flopy.modflow.Modflow.load('example.nam')
model.modelgrid.load_coord_info('example.nam') # No api available for temporal data
print(model.modeltime.start_datetime)
# 1-1-1970
print(model.modelgrid)
# xll:2.691130606358858; yll:2.3968551745226057; rotation:42.0; units:meters; lenuni:2
The text was updated successfully, but these errors were encountered:
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.
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
The text was updated successfully, but these errors were encountered: