Separate model classes introduced for each model type. Model classes contain name file options.
Simulation class moved into modflow folder. All end user interface classes now in modflow folder.develop
parent
d5f21138cf
commit
b35c7e7e24
|
@ -23,8 +23,8 @@ def test_mf6():
|
|||
exgmnameb='gwf2')
|
||||
assert isinstance(gwfgwf, flopy.mf6.modflow.mfgwfgwf.ModflowGwfgwf)
|
||||
|
||||
gwf = flopy.mf6.MFModel(sim, model_type='gwf6')
|
||||
assert isinstance(gwf, flopy.mf6.MFModel)
|
||||
gwf = flopy.mf6.ModflowGwf(sim)
|
||||
assert isinstance(gwf, flopy.mf6.ModflowGwf)
|
||||
|
||||
ims = flopy.mf6.modflow.mfims.ModflowIms(sim)
|
||||
assert isinstance(ims, flopy.mf6.modflow.mfims.ModflowIms)
|
||||
|
@ -101,12 +101,17 @@ def test_mf6():
|
|||
|
||||
# Verify files were written
|
||||
assert os.path.isfile(os.path.join(out_dir, 'mfsim.nam'))
|
||||
exts = ['gwfgwf', 'ims', 'nam', 'dis', 'disu', 'disv', 'npf', 'ic',
|
||||
exts_model = ['nam', 'dis', 'disu', 'disv', 'npf', 'ic',
|
||||
'sto', 'hfb', 'gnc', 'chd', 'wel', 'drn', 'riv', 'ghb', 'rch',
|
||||
'rcha', 'evt', 'evta', 'maw', 'sfr', 'lak', 'mvr']
|
||||
for ext in exts:
|
||||
fname = os.path.join(out_dir, 'modflowtest.{}'.format(ext))
|
||||
exts_sim = ['gwfgwf', 'ims', 'tdis']
|
||||
for ext in exts_model:
|
||||
fname = os.path.join(out_dir, 'model.{}'.format(ext))
|
||||
assert os.path.isfile(fname), fname + ' not found'
|
||||
for ext in exts_sim:
|
||||
fname = os.path.join(out_dir, 'sim.{}'.format(ext))
|
||||
assert os.path.isfile(fname), fname + ' not found'
|
||||
|
||||
|
||||
return
|
||||
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
import numpy as np
|
||||
import os
|
||||
import shutil
|
||||
import platform
|
||||
import shutil
|
||||
|
||||
import flopy
|
||||
|
||||
from flopy.mf6.mfsimulation import MFSimulation
|
||||
from flopy.mf6.mfmodel import MFModel
|
||||
from flopy.mf6.modflow import mfims, mftdis, mfgwfic, mfgwfnpf, mfgwfdis
|
||||
from flopy.mf6.modflow import mfgwfriv, mfgwfsto, mfgwfoc, mfgwfwel, mfgwfdrn
|
||||
from flopy.mf6.modflow import mfims, mftdis, mfgwfic, mfgwfnpf, mfgwfdis, mfgwf
|
||||
from flopy.mf6.modflow.mfsimulation import MFSimulation
|
||||
|
||||
out_dir = os.path.join('temp', 't502')
|
||||
if os.path.exists(out_dir):
|
||||
|
@ -36,9 +33,8 @@ def test_create_and_run_model():
|
|||
perioddata=tdis_rc)
|
||||
|
||||
# create model instance
|
||||
model = MFModel(sim, model_type='gwf6',
|
||||
modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
model = mfgwf.ModflowGwf(sim, modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
|
||||
# create solution and add the model
|
||||
ims_package = mfims.ModflowIms(sim, print_option='ALL',
|
||||
|
|
|
@ -12,7 +12,7 @@ def download_mf6_distribution():
|
|||
"""
|
||||
|
||||
# set url
|
||||
dirname = 'mf6.0.1'
|
||||
dirname = 'mf6.0.2'
|
||||
url = 'https://water.usgs.gov/ogw/modflow/{0}.zip'.format(dirname)
|
||||
|
||||
# create folder for mf6 distribution download
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
import os
|
||||
import flopy
|
||||
import platform
|
||||
from flopy.mf6.mfsimulation import MFSimulation
|
||||
from flopy.mf6.data.mfdatautil import ArrayUtil
|
||||
import flopy.utils.binaryfile as bf
|
||||
|
||||
import numpy as np
|
||||
|
||||
import flopy
|
||||
import flopy.utils.binaryfile as bf
|
||||
from flopy.mf6.data.mfdatautil import ArrayUtil
|
||||
from flopy.mf6.modflow.mfsimulation import MFSimulation
|
||||
|
||||
try:
|
||||
import pymake
|
||||
except:
|
||||
|
@ -271,8 +274,6 @@ def test005_advgw_tidal():
|
|||
"""
|
||||
|
||||
def test006_gwf3():
|
||||
from flopy.mf6.utils.binaryfile_utils import _reshape_binary_data
|
||||
|
||||
# init paths
|
||||
test_ex_name = 'test006_gwf3'
|
||||
model_name = 'gwf_1'
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
import os
|
||||
import flopy
|
||||
import platform
|
||||
|
||||
import numpy as np
|
||||
import os
|
||||
from flopy.mf6.mfsimulation import MFSimulation
|
||||
from flopy.mf6.mfmodel import MFModel
|
||||
|
||||
import flopy
|
||||
import flopy.utils.binaryfile as bf
|
||||
from flopy.mf6.data.mfdata import DataStorageType
|
||||
from flopy.mf6.data.mfdatautil import ArrayUtil
|
||||
from flopy.mf6.data.mfstructure import FlopyException
|
||||
from flopy.mf6.modflow.mfgwf import ModflowGwf
|
||||
from flopy.mf6.modflow.mfgwfchd import ModflowGwfchd
|
||||
from flopy.mf6.modflow.mfgwfdis import ModflowGwfdis
|
||||
from flopy.mf6.modflow.mfgwfdisv import ModflowGwfdisv
|
||||
|
@ -16,8 +20,8 @@ from flopy.mf6.modflow.mfgwfgnc import ModflowGwfgnc
|
|||
from flopy.mf6.modflow.mfgwfgwf import ModflowGwfgwf
|
||||
from flopy.mf6.modflow.mfgwfhfb import ModflowGwfhfb
|
||||
from flopy.mf6.modflow.mfgwfic import ModflowGwfic
|
||||
from flopy.mf6.modflow.mfgwfoc import ModflowGwfoc
|
||||
from flopy.mf6.modflow.mfgwfnpf import ModflowGwfnpf
|
||||
from flopy.mf6.modflow.mfgwfoc import ModflowGwfoc
|
||||
from flopy.mf6.modflow.mfgwfrch import ModflowGwfrch
|
||||
from flopy.mf6.modflow.mfgwfrcha import ModflowGwfrcha
|
||||
from flopy.mf6.modflow.mfgwfriv import ModflowGwfriv
|
||||
|
@ -25,14 +29,11 @@ from flopy.mf6.modflow.mfgwfsfr import ModflowGwfsfr
|
|||
from flopy.mf6.modflow.mfgwfsto import ModflowGwfsto
|
||||
from flopy.mf6.modflow.mfgwfwel import ModflowGwfwel
|
||||
from flopy.mf6.modflow.mfims import ModflowIms
|
||||
from flopy.mf6.modflow.mfsimulation import MFSimulation
|
||||
from flopy.mf6.modflow.mftdis import ModflowTdis
|
||||
from flopy.mf6.modflow.mfutlobs import ModflowUtlobs
|
||||
from flopy.mf6.modflow.mfutlts import ModflowUtlts
|
||||
from flopy.mf6.data.mfdatautil import ArrayUtil
|
||||
from flopy.mf6.data.mfdata import DataStorageType
|
||||
from flopy.mf6.utils import testutils
|
||||
from flopy.mf6.data.mfstructure import FlopyException
|
||||
import flopy.utils.binaryfile as bf
|
||||
|
||||
try:
|
||||
import pymake
|
||||
|
@ -78,19 +79,18 @@ def np001():
|
|||
kwargs['bad_kwarg'] = 20
|
||||
try:
|
||||
ex = False
|
||||
bad_model = MFModel(test_sim, model_type='gwf6', modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name),
|
||||
**kwargs)
|
||||
bad_model = ModflowGwf(test_sim, modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name),
|
||||
**kwargs)
|
||||
except FlopyException:
|
||||
ex = True
|
||||
assert (ex == True)
|
||||
|
||||
kwargs = {}
|
||||
kwargs['xul'] = 20.5
|
||||
good_model = MFModel(test_sim, model_type='gwf6',
|
||||
modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name),
|
||||
**kwargs)
|
||||
good_model = ModflowGwf(test_sim, modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name),
|
||||
**kwargs)
|
||||
|
||||
# create simulation
|
||||
sim = MFSimulation(sim_name=test_ex_name, version='mf6', exe_name=exe_name,
|
||||
|
@ -108,8 +108,8 @@ def np001():
|
|||
preconditioner_drop_tolerance=0.01,
|
||||
number_orthogonalizations=2)
|
||||
|
||||
model = MFModel(sim, model_type='gwf6', modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
model = ModflowGwf(sim, modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
|
||||
dis_package = flopy.mf6.ModflowGwfdis(model, length_units='FEET', nlay=1,
|
||||
nrow=1, ncol=10, delr=500.0,
|
||||
|
@ -234,8 +234,8 @@ def np002():
|
|||
tdis_rc = [(6.0, 2, 1.0), (6.0, 3, 1.0)]
|
||||
tdis_package = ModflowTdis(sim, time_units='DAYS', nper=2,
|
||||
perioddata=tdis_rc)
|
||||
model = MFModel(sim, model_type='gwf6', modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
model = ModflowGwf(sim, modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
ims_package = ModflowIms(sim, print_option='ALL', complexity='SIMPLE',
|
||||
outer_hclose=0.00001,
|
||||
outer_maximum=50, under_relaxation='NONE',
|
||||
|
@ -347,8 +347,8 @@ def test021_twri():
|
|||
tdis_rc = [(86400.0, 1, 1.0)]
|
||||
tdis_package = ModflowTdis(sim, time_units='SECONDS', nper=1,
|
||||
perioddata=tdis_rc)
|
||||
model = MFModel(sim, model_type='gwf6', modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
model = ModflowGwf(sim, modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
ims_package = ModflowIms(sim, print_option='SUMMARY', outer_hclose=0.0001,
|
||||
outer_maximum=500, under_relaxation='NONE',
|
||||
inner_maximum=100,
|
||||
|
@ -452,8 +452,8 @@ def test005_advgw_tidal():
|
|||
(10.0, 120, 1.0)]
|
||||
tdis_package = ModflowTdis(sim, time_units='DAYS', nper=4,
|
||||
perioddata=tdis_rc)
|
||||
model = MFModel(sim, model_type='gwf6', modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
model = ModflowGwf(sim, modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
ims_package = ModflowIms(sim, print_option='SUMMARY', complexity='SIMPLE',
|
||||
outer_hclose=0.0001,
|
||||
outer_maximum=500, under_relaxation='NONE',
|
||||
|
@ -831,8 +831,8 @@ def test004_bcfss():
|
|||
tdis_rc = [(1.0, 1, 1.0), (1.0, 1, 1.0)]
|
||||
tdis_package = ModflowTdis(sim, time_units='DAYS', nper=2,
|
||||
perioddata=tdis_rc)
|
||||
model = MFModel(sim, model_type='gwf6', modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
model = ModflowGwf(sim, modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
ims_package = ModflowIms(sim, print_option='ALL',
|
||||
csv_output_filerecord='bcf2ss.ims.csv',
|
||||
complexity='SIMPLE',
|
||||
|
@ -938,8 +938,8 @@ def test035_fhb():
|
|||
tdis_rc = [(400.0, 10, 1.0), (200.0, 4, 1.0), (400.0, 6, 1.1)]
|
||||
tdis_package = ModflowTdis(sim, time_units='DAYS', nper=3,
|
||||
perioddata=tdis_rc)
|
||||
model = MFModel(sim, model_type='gwf6', modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
model = ModflowGwf(sim, modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
ims_package = ModflowIms(sim, print_option='SUMMARY', complexity='SIMPLE',
|
||||
outer_hclose=0.001,
|
||||
outer_maximum=120, under_relaxation='NONE',
|
||||
|
@ -1036,8 +1036,8 @@ def test006_gwf3_disv():
|
|||
tdis_rc = [(1.0, 1, 1.0)]
|
||||
tdis_package = ModflowTdis(sim, time_units='DAYS', nper=1,
|
||||
perioddata=tdis_rc)
|
||||
model = MFModel(sim, model_type='gwf6', modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
model = ModflowGwf(sim, modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
ims_package = ModflowIms(sim, print_option='SUMMARY',
|
||||
outer_hclose=0.00000001,
|
||||
outer_maximum=1000, under_relaxation='NONE',
|
||||
|
@ -1162,10 +1162,10 @@ def test006_2models_gnc():
|
|||
tdis_rc = [(1.0, 1, 1.0)]
|
||||
tdis_package = ModflowTdis(sim, time_units='DAYS', nper=1,
|
||||
perioddata=tdis_rc)
|
||||
model_1 = MFModel(sim, model_type='gwf6', modelname=model_name_1,
|
||||
model_nam_file='{}.nam'.format(model_name_1))
|
||||
model_2 = MFModel(sim, model_type='gwf6', modelname=model_name_2,
|
||||
model_nam_file='{}.nam'.format(model_name_2))
|
||||
model_1 = ModflowGwf(sim, modelname=model_name_1,
|
||||
model_nam_file='{}.nam'.format(model_name_1))
|
||||
model_2 = ModflowGwf(sim, modelname=model_name_2,
|
||||
model_nam_file='{}.nam'.format(model_name_2))
|
||||
ims_package = ModflowIms(sim, print_option='SUMMARY',
|
||||
outer_hclose=0.00000001,
|
||||
outer_maximum=1000, under_relaxation='NONE',
|
||||
|
@ -1311,8 +1311,8 @@ def test050_circle_island():
|
|||
tdis_rc = [(1.0, 1, 1.0)]
|
||||
tdis_package = ModflowTdis(sim, time_units='DAYS', nper=1,
|
||||
perioddata=tdis_rc)
|
||||
model = MFModel(sim, model_type='gwf6', modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
model = ModflowGwf(sim, modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
ims_package = ModflowIms(sim, print_option='SUMMARY',
|
||||
outer_hclose=0.000001,
|
||||
outer_maximum=500, under_relaxation='NONE',
|
||||
|
@ -1390,8 +1390,8 @@ def test028_sfr():
|
|||
tdis_rc = [(1577889000, 50, 1.1), (1577889000, 50, 1.1)]
|
||||
tdis_package = ModflowTdis(sim, time_units='SECONDS', nper=2,
|
||||
perioddata=tdis_rc, fname='simulation.tdis')
|
||||
model = MFModel(sim, model_type='gwf6', modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
model = ModflowGwf(sim, modelname=model_name,
|
||||
model_nam_file='{}.nam'.format(model_name))
|
||||
model.name_file.save_flows.set_data(True)
|
||||
ims_package = ModflowIms(sim, print_option='SUMMARY', outer_hclose=0.00001,
|
||||
outer_maximum=100, under_relaxation='DBD',
|
||||
|
|
|
@ -12,7 +12,7 @@ Models and Packages
|
|||
The following is a list of the classes available to work with MODFLOW 6 models. These classes should support all of the options available in the current version of MODFLOW 6.
|
||||
|
||||
* MFSimulation
|
||||
* MFModel
|
||||
* ModflowGwf
|
||||
* ModflowNam
|
||||
* ModflowTdis
|
||||
* ModflowGwfgwf
|
||||
|
|
|
@ -134,8 +134,8 @@
|
|||
"\n",
|
||||
"# Create the Flopy groundwater flow (gwf) model object\n",
|
||||
"model_nam_file = '{}.nam'.format(name)\n",
|
||||
"gwf = flopy.mf6.MFModel(sim, model_type='gwf6', modelname=name, \n",
|
||||
" model_nam_file=model_nam_file)\n",
|
||||
"gwf = flopy.mf6.ModflowGwf(sim, modelname=name, \n",
|
||||
" model_nam_file=model_nam_file)\n",
|
||||
"\n",
|
||||
"# Create the Flopy iterative model solver (ims) Package object\n",
|
||||
"ims = flopy.mf6.modflow.mfims.ModflowIms(sim, complexity='SIMPLE')"
|
||||
|
|
|
@ -108,8 +108,8 @@
|
|||
" nper=4, perioddata=tdis_rc)\n",
|
||||
"\n",
|
||||
"# create gwf model\n",
|
||||
"gwf = flopy.mf6.MFModel(sim, model_type='gwf6', modelname=model_name,\n",
|
||||
" model_nam_file='{}.nam'.format(model_name))\n",
|
||||
"gwf = flopy.mf6.ModflowGwf(sim, modelname=model_name,\n",
|
||||
" model_nam_file='{}.nam'.format(model_name))\n",
|
||||
"gwf.name_file.save_flows = True\n",
|
||||
"\n",
|
||||
"# create iterative model solution and register the gwf model with it\n",
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
"flopy.mf6.MFSimulation \n",
|
||||
"* MODFLOW Simulation Class. Entry point into any MODFLOW simulation.\n",
|
||||
"\n",
|
||||
"flopy.mf6.MFModel\n",
|
||||
"* MODFLOW Model Class. Represents a single model in a simulation.\n",
|
||||
"flopy.mf6.ModflowGwf\n",
|
||||
"* MODFLOW Groundwater Flow Model Class. Represents a single model in a simulation.\n",
|
||||
"\n",
|
||||
"flopy.mf6.Modflow[pc]\n",
|
||||
"* MODFLOW package classes where [pc] is the abbreviation of the package name. Each package is a seperate class. For packages that are part of a groundwater flow model, the abbreviation begins with \"Gwf\". For example, \"flopy.mf6.ModflowGwfdis\" is the Discretization package.\n",
|
||||
|
@ -95,7 +95,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Next one or more models are created using the MFModel class. The first parameter of the MFModel class is the simulation object that the model will be a part of."
|
||||
"Next one or more models are created using the ModflowGwf class. The first parameter of the ModflowGwf class is the simulation object that the model will be a part of."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -105,9 +105,8 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"model_name = 'example_model'\n",
|
||||
"model = flopy.mf6.MFModel(sim, model_type='gwf6',\n",
|
||||
" modelname=model_name,\n",
|
||||
" model_nam_file='{}.nam'.format(model_name))"
|
||||
"model = flopy.mf6.ModflowGwf(sim, modelname=model_name,\n",
|
||||
" model_nam_file='{}.nam'.format(model_name))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -137,7 +136,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Each MFModel object needs to be associated with an ModflowIms object. This is done by calling the MFSimulation object's \"register_ims_package\" method. The first parameter in this method is the ModflowIms object and the second parameter is a list of model names (strings) for the models to be associated with the ModflowIms object."
|
||||
"Each ModflowGwf object needs to be associated with an ModflowIms object. This is done by calling the MFSimulation object's \"register_ims_package\" method. The first parameter in this method is the ModflowIms object and the second parameter is a list of model names (strings) for the models to be associated with the ModflowIms object."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -5,6 +5,5 @@ from .modflow import *
|
|||
from . import utils
|
||||
|
||||
from .data import mfdatascalar, mfdatalist, mfdataarray
|
||||
from .mfsimulation import MFSimulation
|
||||
from .mfmodel import MFModel
|
||||
from .mfbase import ExtFileAction
|
||||
|
|
|
@ -749,18 +749,38 @@ class MFDocString(object):
|
|||
self.parameter_header = '{}Parameters\n{}' \
|
||||
'----------'.format(self.indent, self.indent)
|
||||
self.parameters = []
|
||||
self.model_parameters = []
|
||||
|
||||
def add_parameter(self, param_descr, beginning_of_list=False):
|
||||
def add_parameter(self, param_descr, beginning_of_list=False,
|
||||
model_parameter=False):
|
||||
if beginning_of_list:
|
||||
self.parameters.insert(0, param_descr)
|
||||
if model_parameter:
|
||||
self.model_parameters.insert(0, param_descr)
|
||||
else:
|
||||
self.parameters.append(param_descr)
|
||||
if model_parameter:
|
||||
self.model_parameters.append(param_descr)
|
||||
|
||||
def get_doc_string(self):
|
||||
def get_doc_string(self, model_doc_string=False):
|
||||
doc_string = '{}"""\n{}{}\n\n{}\n'.format(self.indent, self.indent,
|
||||
self.description,
|
||||
self.parameter_header)
|
||||
for parameter in self.parameters:
|
||||
if model_doc_string:
|
||||
param_list = self.model_parameters
|
||||
doc_string = '{} modelname : string\n name of the ' \
|
||||
'model\n model_nam_file : string\n' \
|
||||
' relative path to the model name file from ' \
|
||||
'model working folder\n version : string\n' \
|
||||
' version of modflow\n exe_name : string\n'\
|
||||
' model executable name\n' \
|
||||
' model_ws : string\n' \
|
||||
' model working folder path' \
|
||||
'\n'.format(doc_string)
|
||||
else:
|
||||
param_list = self.parameters
|
||||
for parameter in param_list:
|
||||
doc_string += '{}\n'.format(parameter)
|
||||
doc_string += '\n{}"""'.format(self.indent)
|
||||
return doc_string
|
||||
if not model_doc_string:
|
||||
doc_string += '\n{}"""'.format(self.indent)
|
||||
return doc_string
|
||||
|
|
|
@ -290,42 +290,71 @@ class PackageContainer(object):
|
|||
def package_factory(package_type, model_type):
|
||||
package_abbr = '{}{}'.format(model_type, package_type)
|
||||
package_utl_abbr = 'utl{}'.format(package_type)
|
||||
base_path, tail = os.path.split(os.path.realpath(__file__))
|
||||
package_path = os.path.join(base_path, 'modflow')
|
||||
package_list = []
|
||||
# iterate through python files
|
||||
package_file_paths = glob.glob(os.path.join(package_path, "*.py"))
|
||||
package_file_paths = PackageContainer.get_package_file_paths()
|
||||
for package_file_path in package_file_paths:
|
||||
package_file_name = os.path.basename(package_file_path)
|
||||
module_path = os.path.splitext(package_file_name)[0]
|
||||
module_name = '{}{}{}'.format('Modflow', module_path[2].upper(),
|
||||
module_path[3:])
|
||||
if module_name.startswith("__"):
|
||||
continue
|
||||
|
||||
# import
|
||||
module = importlib.import_module("flopy.mf6.modflow.{}".format(
|
||||
module_path))
|
||||
|
||||
# iterate imported items
|
||||
for item in dir(module):
|
||||
value = getattr(module, item)
|
||||
# verify this is a class
|
||||
if not value or not inspect.isclass(value) or not \
|
||||
hasattr(value, 'package_abbr'):
|
||||
continue
|
||||
if package_type is None:
|
||||
package_list.append(value)
|
||||
else:
|
||||
# check package type
|
||||
if value.package_abbr == package_abbr or \
|
||||
value.package_abbr == package_utl_abbr:
|
||||
return value
|
||||
module = PackageContainer.get_module(package_file_path)
|
||||
if module is not None:
|
||||
# iterate imported items
|
||||
for item in dir(module):
|
||||
value = PackageContainer.get_module_val(module, item,
|
||||
'package_abbr')
|
||||
if value is not None:
|
||||
if package_type is None:
|
||||
package_list.append(value)
|
||||
else:
|
||||
# check package type
|
||||
if value.package_abbr == package_abbr or \
|
||||
value.package_abbr == package_utl_abbr:
|
||||
return value
|
||||
if package_type is None:
|
||||
return package_list
|
||||
else:
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def model_factory(model_type):
|
||||
package_file_paths = PackageContainer.get_package_file_paths()
|
||||
for package_file_path in package_file_paths:
|
||||
module = PackageContainer.get_module(package_file_path)
|
||||
if module is not None:
|
||||
# iterate imported items
|
||||
for item in dir(module):
|
||||
value = PackageContainer.get_module_val(module, item,
|
||||
'model_type')
|
||||
if value is not None and value.model_type == model_type:
|
||||
return value
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def get_module_val(module, item, attrb):
|
||||
value = getattr(module, item)
|
||||
# verify this is a class
|
||||
if not value or not inspect.isclass(value) or not \
|
||||
hasattr(value, attrb):
|
||||
return None
|
||||
return value
|
||||
|
||||
@staticmethod
|
||||
def get_module(package_file_path):
|
||||
package_file_name = os.path.basename(package_file_path)
|
||||
module_path = os.path.splitext(package_file_name)[0]
|
||||
module_name = '{}{}{}'.format('Modflow', module_path[2].upper(),
|
||||
module_path[3:])
|
||||
if module_name.startswith("__"):
|
||||
return None
|
||||
|
||||
# import
|
||||
return importlib.import_module("flopy.mf6.modflow.{}".format(
|
||||
module_path))
|
||||
|
||||
@staticmethod
|
||||
def get_package_file_paths():
|
||||
base_path, tail = os.path.split(os.path.realpath(__file__))
|
||||
package_path = os.path.join(base_path, 'modflow')
|
||||
return glob.glob(os.path.join(package_path, "*.py"))
|
||||
|
||||
def _add_package(self, package, path):
|
||||
# put in packages list and update lookup dictionaries
|
||||
self.packages.append(package)
|
||||
|
|
|
@ -73,7 +73,7 @@ class MFModel(PackageContainer):
|
|||
--------
|
||||
|
||||
"""
|
||||
def __init__(self, simulation, model_type='gwf6', modelname='modflowtest',
|
||||
def __init__(self, simulation, model_type='gwf6', modelname='model',
|
||||
model_nam_file=None, version='mf6',
|
||||
exe_name='mf6.exe', add_to_simulation=True,
|
||||
structure=None, model_rel_path='.', **kwargs):
|
||||
|
@ -161,10 +161,9 @@ class MFModel(PackageContainer):
|
|||
super(MFModel, self).__setattr__(key, value)
|
||||
|
||||
@classmethod
|
||||
def load(cls, simulation, simulation_data, structure,
|
||||
modelname='NewModel', model_nam_file='modflowtest.nam',
|
||||
type='gwf', version='mf6', exe_name='mf6.exe', strict=True,
|
||||
model_rel_path='.'):
|
||||
def load_base(cls, simulation, structure, modelname='NewModel',
|
||||
model_nam_file='modflowtest.nam', type='gwf', version='mf6',
|
||||
exe_name='mf6.exe', strict=True, model_rel_path='.'):
|
||||
"""
|
||||
Load an existing model.
|
||||
|
||||
|
|
|
@ -1,35 +1,37 @@
|
|||
# imports
|
||||
from .mfnam import ModflowNam
|
||||
from .mftdis import ModflowTdis
|
||||
from .mfgwfgwf import ModflowGwfgwf
|
||||
from .mfims import ModflowIms
|
||||
from .mfmvr import ModflowMvr
|
||||
from .mfgnc import ModflowGnc
|
||||
from .mfutlobs import ModflowUtlobs
|
||||
from .mfutlts import ModflowUtlts
|
||||
from .mfutltas import ModflowUtltas
|
||||
from .mfutllaktab import ModflowUtllaktab
|
||||
from .mfgwfnam import ModflowGwfnam
|
||||
from .mfgwfdis import ModflowGwfdis
|
||||
from .mfgwfdisv import ModflowGwfdisv
|
||||
from .mfgwfdisu import ModflowGwfdisu
|
||||
from .mfgwfic import ModflowGwfic
|
||||
from .mfgwfnpf import ModflowGwfnpf
|
||||
from .mfgwfsto import ModflowGwfsto
|
||||
from .mfgwfhfb import ModflowGwfhfb
|
||||
from .mfgwfchd import ModflowGwfchd
|
||||
from .mfgwfwel import ModflowGwfwel
|
||||
from .mfgwfdrn import ModflowGwfdrn
|
||||
from .mfgwfriv import ModflowGwfriv
|
||||
from .mfgwfghb import ModflowGwfghb
|
||||
from .mfgwfrch import ModflowGwfrch
|
||||
from .mfgwfrcha import ModflowGwfrcha
|
||||
from .mfgwfevt import ModflowGwfevt
|
||||
from .mfgwfevta import ModflowGwfevta
|
||||
from .mfgwfmaw import ModflowGwfmaw
|
||||
from .mfgwfsfr import ModflowGwfsfr
|
||||
from .mfgwflak import ModflowGwflak
|
||||
from .mfgwfuzf import ModflowGwfuzf
|
||||
from .mfgwfmvr import ModflowGwfmvr
|
||||
from .mfgwfgnc import ModflowGwfgnc
|
||||
from .mfgwfoc import ModflowGwfoc
|
||||
# imports
|
||||
from .mfsimulation import MFSimulation
|
||||
from .mfnam import ModflowNam
|
||||
from .mftdis import ModflowTdis
|
||||
from .mfgwfgwf import ModflowGwfgwf
|
||||
from .mfims import ModflowIms
|
||||
from .mfmvr import ModflowMvr
|
||||
from .mfgnc import ModflowGnc
|
||||
from .mfutlobs import ModflowUtlobs
|
||||
from .mfutlts import ModflowUtlts
|
||||
from .mfutltas import ModflowUtltas
|
||||
from .mfutllaktab import ModflowUtllaktab
|
||||
from .mfgwfnam import ModflowGwfnam
|
||||
from .mfgwf import ModflowGwf
|
||||
from .mfgwfdis import ModflowGwfdis
|
||||
from .mfgwfdisv import ModflowGwfdisv
|
||||
from .mfgwfdisu import ModflowGwfdisu
|
||||
from .mfgwfic import ModflowGwfic
|
||||
from .mfgwfnpf import ModflowGwfnpf
|
||||
from .mfgwfsto import ModflowGwfsto
|
||||
from .mfgwfhfb import ModflowGwfhfb
|
||||
from .mfgwfchd import ModflowGwfchd
|
||||
from .mfgwfwel import ModflowGwfwel
|
||||
from .mfgwfdrn import ModflowGwfdrn
|
||||
from .mfgwfriv import ModflowGwfriv
|
||||
from .mfgwfghb import ModflowGwfghb
|
||||
from .mfgwfrch import ModflowGwfrch
|
||||
from .mfgwfrcha import ModflowGwfrcha
|
||||
from .mfgwfevt import ModflowGwfevt
|
||||
from .mfgwfevta import ModflowGwfevta
|
||||
from .mfgwfmaw import ModflowGwfmaw
|
||||
from .mfgwfsfr import ModflowGwfsfr
|
||||
from .mfgwflak import ModflowGwflak
|
||||
from .mfgwfuzf import ModflowGwfuzf
|
||||
from .mfgwfmvr import ModflowGwfmvr
|
||||
from .mfgwfgnc import ModflowGwfgnc
|
||||
from .mfgwfoc import ModflowGwfoc
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
# DO NOT MODIFY THIS FILE DIRECTLY. THIS FILE MUST BE CREATED BY
|
||||
# mf6/utils/createpackages.py
|
||||
from .. import mfmodel
|
||||
from ..data.mfdatautil import ListTemplateGenerator, ArrayTemplateGenerator
|
||||
|
||||
|
||||
class ModflowGwf(mfmodel.MFModel):
|
||||
"""
|
||||
Modflowgwf defines a gwf model
|
||||
|
||||
Parameters
|
||||
----------
|
||||
modelname : string
|
||||
name of the model
|
||||
model_nam_file : string
|
||||
relative path to the model name file from model working folder
|
||||
version : string
|
||||
version of modflow
|
||||
exe_name : string
|
||||
model executable name
|
||||
model_ws : string
|
||||
model working folder path
|
||||
sim : MFSimulation
|
||||
Simulation that this model is a part of. Model is automatically
|
||||
added to simulation when it is initialized.
|
||||
list : string
|
||||
* list (string) is name of the listing file to create for this GWF
|
||||
model. If not specified, then the name of the list file will be the
|
||||
basename of the GWF model name file and the '.lst' extension. For
|
||||
example, if the GWF name file is called "my.model.nam" then the list
|
||||
file will be called "my.model.lst".
|
||||
print_input : boolean
|
||||
* print_input (boolean) keyword to indicate that the list of all model
|
||||
stress package information will be written to the listing file
|
||||
immediately after it is read.
|
||||
print_flows : boolean
|
||||
* print_flows (boolean) keyword to indicate that the list of all model
|
||||
package flow rates will be printed to the listing file for every
|
||||
stress period time step in which "BUDGET PRINT" is specified in
|
||||
Output Control. If there is no Output Control option and
|
||||
"PRINT_FLOWS" is specified, then flow rates are printed for the last
|
||||
time step of each stress period.
|
||||
save_flows : boolean
|
||||
* save_flows (boolean) keyword to indicate that all model package flow
|
||||
terms will be written to the file specified with "BUDGET FILEOUT" in
|
||||
Output Control.
|
||||
newtonoptions : [under_relaxation]
|
||||
* under_relaxation (string) keyword that indicates whether the
|
||||
groundwater head in a cell will be under-relaxed when water levels
|
||||
fall below the bottom of the model below any given cell. By default,
|
||||
Newton-Raphson UNDER_RELAXATION is not applied.
|
||||
packages : [ftype, fname, pname]
|
||||
* ftype (string) is the file type, which must be one of the following
|
||||
character values shown in table~ref{table:ftype}. Ftype may be
|
||||
entered in any combination of uppercase and lowercase.
|
||||
* fname (string) is the name of the file containing the package input.
|
||||
The path to the file should be included if the file is not located in
|
||||
the folder where the program was run.
|
||||
* pname (string) is the user-defined name for the package. PNAME is
|
||||
restricted to 16 characters. No spaces are allowed in PNAME. PNAME
|
||||
character values are read and stored by the program for stress
|
||||
packages only. These names may be useful for labeling purposes when
|
||||
multiple stress packages of the same type are located within a single
|
||||
GWF Model. If PNAME is specified for a stress package, then PNAME
|
||||
will be used in the flow budget table in the listing file; it will
|
||||
also be used for the text entry in the cell-by-cell budget file.
|
||||
PNAME is case insensitive and is stored in all upper case letters.
|
||||
|
||||
Methods
|
||||
-------
|
||||
load : (simulation : MFSimulationData, model_name : string,
|
||||
namfile : string, version : string, exe_name : string,
|
||||
model_ws : string, strict : boolean) : MFSimulation
|
||||
a class method that loads a model from files
|
||||
"""
|
||||
model_type = 'gwf'
|
||||
|
||||
def __init__(self, simulation, modelname='model', model_nam_file=None,
|
||||
version='mf6', exe_name='mf6.exe', model_rel_path='.',
|
||||
list=None, print_input=None, print_flows=None,
|
||||
save_flows=None, newtonoptions=None, packages=None, **kwargs):
|
||||
super(ModflowGwf, self).__init__(simulation, model_type='gwf6',
|
||||
modelname=modelname,
|
||||
model_nam_file=model_nam_file,
|
||||
version=version, exe_name=exe_name,
|
||||
model_rel_path=model_rel_path,
|
||||
**kwargs)
|
||||
|
||||
self.name_file.list.set_data(list)
|
||||
self.name_file.list.set_data(print_input)
|
||||
self.name_file.list.set_data(print_flows)
|
||||
self.name_file.list.set_data(save_flows)
|
||||
self.name_file.list.set_data(newtonoptions)
|
||||
self.name_file.list.set_data(packages)
|
||||
|
||||
@classmethod
|
||||
def load(cls, simulation, structure, modelname='NewModel',
|
||||
model_nam_file='modflowtest.nam', version='mf6',
|
||||
exe_name='mf6.exe', strict=True, model_rel_path='.'):
|
||||
return mfmodel.MFModel.load_base(simulation, structure, modelname,
|
||||
model_nam_file, 'gwf', version,
|
||||
exe_name, strict, model_rel_path)
|
|
@ -6,16 +6,16 @@ mfsimulation module. contains the MFSimulation class
|
|||
import errno
|
||||
import collections
|
||||
import os.path
|
||||
from ..mbase import run_model
|
||||
from .mfbase import PackageContainer, MFFileMgmt, ExtFileAction
|
||||
from .mfbase import PackageContainerType
|
||||
from .mfmodel import MFModel
|
||||
from .mfpackage import MFPackage
|
||||
from .data.mfstructure import DatumType
|
||||
from .data import mfstructure, mfdata
|
||||
from .utils import binaryfile_utils
|
||||
from .utils import mfobservation
|
||||
from .modflow import mfnam, mfims, mftdis, mfgwfgnc, mfgwfmvr
|
||||
from flopy.mbase import run_model
|
||||
from flopy.mf6.mfbase import PackageContainer, MFFileMgmt, ExtFileAction
|
||||
from flopy.mf6.mfbase import PackageContainerType
|
||||
from flopy.mf6.mfmodel import MFModel
|
||||
from flopy.mf6.mfpackage import MFPackage
|
||||
from flopy.mf6.data.mfstructure import DatumType
|
||||
from flopy.mf6.data import mfstructure, mfdata
|
||||
from flopy.mf6.utils import binaryfile_utils
|
||||
from flopy.mf6.utils import mfobservation
|
||||
from flopy.mf6.modflow import mfnam, mfims, mftdis, mfgwfgnc, mfgwfmvr
|
||||
|
||||
|
||||
class SimulationDict(collections.OrderedDict):
|
||||
|
@ -285,7 +285,7 @@ class MFSimulation(PackageContainer):
|
|||
>>> s = flopy6.mfsimulation.load('my simulation', 'simulation.nam')
|
||||
|
||||
"""
|
||||
def __init__(self, sim_name='modflowtest', version='mf6',
|
||||
def __init__(self, sim_name='sim', version='mf6',
|
||||
exe_name='mf6.exe', sim_ws='.',
|
||||
sim_tdis_file='modflow6.tdis'):
|
||||
super(MFSimulation, self).__init__(MFSimulationData(sim_ws), sim_name)
|
||||
|
@ -387,14 +387,12 @@ class MFSimulation(PackageContainer):
|
|||
for item in model_recarray.get_data():
|
||||
# resolve model working folder and name file
|
||||
path, name_file = os.path.split(item[1])
|
||||
|
||||
model_obj = PackageContainer.model_factory(item[0][:-1].lower())
|
||||
# load model
|
||||
instance._models[item[2]] = MFModel.load(
|
||||
instance, instance.simulation_data,
|
||||
instance.structure.model_struct_objs[item[0].lower()],
|
||||
item[2], name_file,
|
||||
item[0], version,
|
||||
exe_name, strict, path)
|
||||
instance._models[item[2]] = model_obj.load(
|
||||
instance,
|
||||
instance.structure.model_struct_objs[item[0].lower()], item[2],
|
||||
name_file, version, exe_name, strict, path)
|
||||
|
||||
# load exchange packages and dependent packages
|
||||
exchange_recarray = instance.name_file.exchanges
|
|
@ -180,7 +180,7 @@ def add_var(init_vars, class_vars, init_param_list, package_properties,
|
|||
default_value = 'None'
|
||||
init_param_list.append('{}={}'.format(clean_ds_name, default_value))
|
||||
package_properties.append(create_property(clean_ds_name))
|
||||
doc_string.add_parameter(description)
|
||||
doc_string.add_parameter(description, model_parameter=True)
|
||||
data_structure_dict[python_name] = 0
|
||||
if class_vars is not None:
|
||||
gen_type = generator_type(data_type)
|
||||
|
@ -190,6 +190,53 @@ def add_var(init_vars, class_vars, init_param_list, package_properties,
|
|||
class_vars.append(format_var_list(new_class_var, path, True))
|
||||
|
||||
|
||||
def build_init_string(init_string, init_param_list):
|
||||
line_chars = len(init_string)
|
||||
for index, param in enumerate(init_param_list):
|
||||
if index + 1 < len(init_param_list):
|
||||
line_chars += len(param) + 2
|
||||
else:
|
||||
line_chars += len(param) + 3
|
||||
if line_chars > 79:
|
||||
init_string = '{},\n {}'.format(
|
||||
init_string, param)
|
||||
line_chars = len(param) + len(' ') + 1
|
||||
else:
|
||||
init_string = '{}, {}'.format(init_string, param)
|
||||
return '{}):\n'.format(init_string)
|
||||
|
||||
|
||||
def build_model_load(model_type):
|
||||
model_load_c = ' Methods\n -------\n' \
|
||||
' load : (simulation : MFSimulationData, model_name : ' \
|
||||
'string,\n namfile : string, ' \
|
||||
'version : string, exe_name : string,\n model_ws : '\
|
||||
'string, strict : boolean) : MFSimulation\n' \
|
||||
' a class method that loads a model from files' \
|
||||
'\n """'
|
||||
|
||||
model_load = " @classmethod\n def load(cls, simulation, structure, "\
|
||||
"modelname='NewModel',\n " \
|
||||
"model_nam_file='modflowtest.nam', version='mf6',\n" \
|
||||
" exe_name='mf6.exe', strict=True, " \
|
||||
"model_rel_path='.'):\n " \
|
||||
"return mfmodel.MFModel.load_base(simulation, structure, " \
|
||||
"modelname,\n " \
|
||||
"model_nam_file, '{}', version,\n" \
|
||||
" exe_name, strict, " \
|
||||
"model_rel_path)\n".format(model_type)
|
||||
return model_load, model_load_c
|
||||
|
||||
|
||||
def build_model_init_vars(param_list):
|
||||
init_var_list = []
|
||||
for param in param_list:
|
||||
param_parts = param.split('=')
|
||||
init_var_list.append(' self.name_file.list.set_data({}'
|
||||
')'.format(param_parts[0]))
|
||||
return '\n'.join(init_var_list)
|
||||
|
||||
|
||||
def create_packages():
|
||||
indent = ' '
|
||||
init_string_def = ' def __init__(self'
|
||||
|
@ -226,6 +273,10 @@ def create_packages():
|
|||
init_file = open(os.path.join(util_path, '..', 'modflow', '__init__.py'),
|
||||
'w')
|
||||
init_file.write('# imports\n')
|
||||
init_file.write('from .mfsimulation import MFSimulation\n')
|
||||
|
||||
nam_import_string = 'from .. import mfmodel\nfrom ..data.mfdatautil ' \
|
||||
'import ListTemplateGenerator, ArrayTemplateGenerator'
|
||||
|
||||
# loop through packages list
|
||||
for package in package_list:
|
||||
|
@ -319,6 +370,7 @@ def create_packages():
|
|||
'\n'.format('\n'.join(class_vars), package_abbr,
|
||||
package[4], package[0].dfn_file_name)
|
||||
init_string_full = init_string_def
|
||||
init_string_model = '{}, simulation'.format(init_string_def)
|
||||
# add variables to init string
|
||||
doc_string.add_parameter(' loading_package : bool\n '
|
||||
'Do not set this parameter. It is intended '
|
||||
|
@ -341,22 +393,10 @@ def create_packages():
|
|||
beginning_of_list=True)
|
||||
init_string_full = '{}, model, loading_package=False'.format(
|
||||
init_string_full)
|
||||
line_chars = len(init_string_full)
|
||||
init_param_list.append('fname=None')
|
||||
init_param_list.append('pname=None')
|
||||
init_param_list.append('parent_file=None')
|
||||
for index, param in enumerate(init_param_list):
|
||||
if index + 1 < len(init_param_list):
|
||||
line_chars += len(param) + 2
|
||||
else:
|
||||
line_chars += len(param) + 3
|
||||
if line_chars > 79:
|
||||
init_string_full = '{},\n {}'.format(
|
||||
init_string_full, param)
|
||||
line_chars = len(param) + len(' ') + 1
|
||||
else:
|
||||
init_string_full = '{}, {}'.format(init_string_full, param)
|
||||
init_string_full = '{}):\n'.format(init_string_full)
|
||||
init_string_full = build_init_string(init_string_full, init_param_list)
|
||||
|
||||
# build init code
|
||||
if package[1] == PackageLevel.sim_level:
|
||||
|
@ -387,6 +427,58 @@ def create_packages():
|
|||
init_file.write('from .mf{} import '
|
||||
'Modflow{}\n'.format(package_name,
|
||||
package_name.title()))
|
||||
|
||||
if package[0].dfn_type == mfstructure.DfnType.model_name_file:
|
||||
# build model file
|
||||
model_param_list = init_param_list[:-3]
|
||||
init_vars = build_model_init_vars(model_param_list)
|
||||
|
||||
model_param_list.insert(0, "model_rel_path='.'")
|
||||
model_param_list.insert(0, "exe_name='mf6.exe'")
|
||||
model_param_list.insert(0, "version='mf6'")
|
||||
model_param_list.insert(0, 'model_nam_file=None')
|
||||
model_param_list.insert(0, "modelname='model'")
|
||||
model_param_list.append("**kwargs")
|
||||
init_string_model = build_init_string(init_string_model,
|
||||
model_param_list)
|
||||
model_name = clean_class_string(package[2])
|
||||
class_def_string = 'class Modflow{}(mfmodel.MFModel):\n'.format(
|
||||
model_name.capitalize())
|
||||
class_def_string = class_def_string.replace('-', '_')
|
||||
doc_string.add_parameter(' sim : MFSimulation\n '
|
||||
'Simulation that this model is a part '
|
||||
'of. Model is automatically\n '
|
||||
'added to simulation when it is '
|
||||
'initialized.',
|
||||
beginning_of_list=True,
|
||||
model_parameter=True)
|
||||
doc_string.description = 'Modflow{} defines a {} model'.format(
|
||||
model_name, model_name)
|
||||
class_var_string = " model_type = '{}'\n".format(model_name)
|
||||
mparent_init_string = ' super(Modflow{}, self)' \
|
||||
'.__init__('.format(model_name.capitalize())
|
||||
spaces = ' ' * len(mparent_init_string)
|
||||
mparent_init_string = "{}simulation, model_type='gwf6',\n{}" \
|
||||
"modelname=modelname,\n{}" \
|
||||
"model_nam_file=model_nam_file,\n{}" \
|
||||
"version=version, exe_name=exe_name,\n{}" \
|
||||
"model_rel_path=model_rel_path,\n{}" \
|
||||
"**kwargs" \
|
||||
")\n".format(mparent_init_string, spaces,
|
||||
spaces, spaces, spaces, spaces)
|
||||
load_txt, doc_text = build_model_load('gwf')
|
||||
package_string = '{}\n{}\n\n\n{}{}\n{}\n{}\n{}{}\n{}\n\n{}'.format(
|
||||
comment_string, nam_import_string, class_def_string,
|
||||
doc_string.get_doc_string(True), doc_text, class_var_string,
|
||||
init_string_model, mparent_init_string, init_vars, load_txt)
|
||||
md_file = open(os.path.join(util_path, '..', 'modflow',
|
||||
'mf{}.py'.format(model_name)),
|
||||
'w')
|
||||
md_file.write(package_string)
|
||||
md_file.close()
|
||||
init_file.write('from .mf{} import '
|
||||
'Modflow{}\n'.format(model_name,
|
||||
model_name.capitalize()))
|
||||
init_file.close()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue