Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
nu=0.025, zeta=[], ssz=[], isource=0,
extension=['swi', 'zta'],
fname_output='swi.zta', unitnumber=None):
"""
Package constructor.
"""
# set default unit number of one is not specified
if unitnumber is None:
unitnumber = ModflowSwi.defaultunit()
name = [ModflowSwi.ftype(), 'DATA(BINARY)']
extra = ['', 'REPLACE']
# Call ancestor's init to set self.parent
Package.__init__(self, model, extension, name, unitnumber, extra=extra)
nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
line = '# Salt Water Intrusion package file for MODFLOW-2000, generated by Flopy.'
self.heading = line
self.npln = npln
self.istrat = istrat
self.iswizt = iswizt
self.nprn = nprn
self.toeslope = toeslope
self.tipslope = tipslope
self.zetamin = zetamin
self.delzeta = delzeta
# Create arrays so that they have the correct size
if self.istrat == 1:
self.nu = Util2d(model, (self.npln + 1,), np.float32, nu,
name='nu')
# set filenames
if filenames is None:
filenames = [None]
elif isinstance(filenames, str):
filenames = [filenames]
# Fill namefile items
name = [ModflowChd.ftype()]
units = [unitnumber]
extra = ['']
# set package name
fname = [filenames[0]]
# Call ancestor's init to set self.parent, extension, name and unit number
Package.__init__(self, model, extension=extension, name=name,
unit_number=units, extra=extra, filenames=fname)
self.url = 'chd.htm'
self.heading = '# {} package for '.format(self.name[0]) + \
' {}, '.format(model.version_types[model.version]) + \
'generated by Flopy.'
if dtype is not None:
self.dtype = dtype
else:
self.dtype = self.get_default_dtype(
structured=self.parent.structured)
self.stress_period_data = MfList(self, stress_period_data)
self.np = 0
if options is None:
fname = filenames[1]
model.add_output_file(ipakcb, fname=fname,
package=ModflowEvt.ftype())
else:
ipakcb = 0
# Fill namefile items
name = [ModflowEvt.ftype()]
units = [unitnumber]
extra = ['']
# set package name
fname = [filenames[0]]
# Call ancestor's init to set self.parent, extension, name and unit number
Package.__init__(self, model, extension=extension, name=name,
unit_number=units, extra=extra, filenames=fname)
nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
self.heading = '# {} package for '.format(self.name[0]) + \
' {}, '.format(model.version_types[model.version]) + \
'generated by Flopy.'
self.url = 'evt.htm'
self.nevtop = nevtop
self.ipakcb = ipakcb
self.external = external
if self.external is False:
load = True
else:
load = model.load
self.surf = Transient2d(model, (nrow, ncol), np.float32,
# set filenames
if filenames is None:
filenames = [None]
elif isinstance(filenames, str):
filenames = [filenames]
# Fill namefile items
name = [ModflowMlt.ftype()]
units = [unitnumber]
extra = ['']
# set package name
fname = [filenames[0]]
# Call ancestor's init to set self.parent, extension, name and unit number
Package.__init__(self, model, extension=extension, name=name,
unit_number=units, extra=extra, filenames=fname)
self.heading = '# {} package for '.format(self.name[0]) + \
' {}, '.format(model.version_types[model.version]) + \
'generated by Flopy.'
self.url = 'mult.htm'
self.nml = 0
if mult_dict is not None:
self.nml = len(mult_dict)
self.mult_dict = mult_dict
# print mult_dict
self.parent.add_package(self)
# set filenames
if filenames is None:
filenames = [None]
elif isinstance(filenames, str):
filenames = [filenames]
# Fill namefile items
name = [Mt3dDsp.ftype()]
units = [unitnumber]
extra = ['']
# set package name
fname = [filenames[0]]
# Call ancestor's init to set self.parent, extension, name and unit number
Package.__init__(self, model, extension=extension, name=name,
unit_number=units, extra=extra, filenames=fname)
nrow = model.nrow
ncol = model.ncol
nlay = model.nlay
ncomp = model.ncomp
mcomp = model.mcomp
self.multiDiff = multiDiff
self.al = Util3d(model, (nlay, nrow, ncol), np.float32, al, name='al',
locat=self.unit_number[0],
array_free_format=False)
self.trpt = Util2d(model, (nlay,), np.float32, trpt, name='trpt',
locat=self.unit_number[0],
array_free_format=False)
self.trpv = Util2d(model, (nlay,), np.float32, trpv, name='trpv',
locat=self.unit_number[0],
def __init__(self, model, nstrm=2, nss=1, nsfrpar=0, nparseg=0, const=128390.4, dleak=0.0001, istcb1=50, istcb2=66,
isfropt=0,
nstrail=10, isuzn=1, nsfrsets=30, irtflg=1, numtim=2, weight=0.75, flwtol=0.0001,
reach_data=None,
segment_data=None,
channel_geometry_data=None,
channel_flow_data=None,
dataset_5=None,
reachinput=False, transroute=False,
tabfiles=False, tabfiles_dict=None,
extension='sfr', unitnumber=17):
"""
Package constructor
"""
Package.__init__(self, model, extension, 'SFR',
unitnumber) # Call ancestor's init to set self.parent, extension, name, and unit number
self.url = 'sfr2.htm'
self.nper = self.parent.nrow_ncol_nlay_nper[-1]
self.nper = 1 if self.nper == 0 else self.nper # otherwise iterations from 0, nper won't run
# Dataset 0 -----------------------------------------------------------------------
self.heading = '# SFR2 for MODFLOW, generated by Flopy.'
# Dataset 1a and 1b. -----------------------------------------------------------------------
self.reachinput = reachinput
self.transroute = transroute
self.tabfiles = tabfiles
self.tabfiles_dict = tabfiles_dict
self.numtab = 0 if not tabfiles else len(tabfiles_dict)
self.maxval = np.max([tb['numval'] for tb in tabfiles_dict.values()]) if self.numtab > 0 else 0
if filenames is None:
filenames = [None]
elif isinstance(filenames, str):
filenames = [filenames]
# Fill namefile items
name = [ModflowSip.ftype()]
units = [unitnumber]
extra = ['']
# set package name
fname = [filenames[0]]
# Call ancestor's init to set self.parent, extension, name and
# unit number
Package.__init__(self, model, extension=extension, name=name,
unit_number=units, extra=extra, filenames=fname)
# check if a valid model version has been specified
if model.version == 'mfusg':
err = 'Error: cannot use {} package '.format(self.name) + \
'with model version {}'.format(model.version)
raise Exception(err)
self.heading = '# {} package for '.format(self.name[0]) + \
' {}, '.format(model.version_types[model.version]) + \
'generated by Flopy.'
self.url = 'sip.htm'
self.mxiter = mxiter
self.nparm = nparm
self.accl = accl
model.add_output_file(iswiobs, fname=fname, binflag=binflag,
extension=ext, package=ModflowSwi2.ftype())
else:
iswiobs = 0
# Fill namefile items
name = [ModflowSwi2.ftype()]
units = [unitnumber]
extra = ['']
# set package name
fname = [filenames[0]]
# Call ancestor's init to set self.parent, extension, name and
# unit number
Package.__init__(self, model, extension=extension, name=name,
unit_number=units, extra=extra, filenames=fname)
nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
self.heading = '# {} package for '.format(self.name[0]) + \
' {}, '.format(model.version_types[model.version]) + \
'generated by Flopy.'
# options
self.fsssopt, self.adaptive = False, False
if isinstance(options, list):
if len(options) < 1:
self.options = None
else:
self.options = options
for o in self.options:
if o.lower() == 'fsssopt':
fname = filenames[idx+3]
model.add_output_file(iu, fname=fname, extension=ext,
package=ModflowSub.ftype())
idx += 1
extensions = [extension]
name = [ModflowSub.ftype()]
units = [unitnumber]
extra = ['']
# set package name
fname = [filenames[0]]
# Call ancestor's init to set self.parent, extension, name and
# unit number
Package.__init__(self, model, extension=extensions, name=name,
unit_number=units, extra=extra, filenames=fname)
nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
self.heading = '# {} package for '.format(self.name[0]) + \
' {}, '.format(model.version_types[model.version]) + \
'generated by Flopy.'
self.url = 'sub.htm'
self.ipakcb = ipakcb
self.isuboc = isuboc
self.idsave = idsave
self.idrest = idrest
self.idbit = idbit
self.nndb = nndb
self.ndb = ndb