Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, model, itrnsp=1, ibctcb=0, mcomp=1, ic_ibound_flg=1,
itvd=1, iadsorb=0, ict=0, cinact=-999., ciclose=1.e-6,
idisp=1, ixdisp=0, diffnc=0., izod=0, ifod=0, icbund=1,
porosity=0.1, bulkd=1., arad=0., dlh=0., dlv=0., dth=0.,
dtv=0., sconc=0.,
extension='bct', unitnumber=None):
# set default unit number of one is not specified
if unitnumber is None:
unitnumber = ModflowBct.defaultunit()
# Call ancestor's init to set self.parent, extension, name and unit
# number
Package.__init__(self, model, extension, ModflowBct.ftype(),
unitnumber)
self.url = 'bct.htm'
nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
self.itrnsp = itrnsp
self.ibctcb = ibctcb
self.mcomp = mcomp
self.ic_ibound_flg = ic_ibound_flg
self.itvd = itvd
self.iadsorb = iadsorb
self.ict = ict
self.cinact = cinact
self.ciclose = ciclose
self.idisp = idisp
self.ixdisp = ixdisp
self.diffnc = diffnc
the ModflowSwi2 class as `flopy.modflow.ModflowSwi2`.
Additional information for this MODFLOW package can be found at the `Online
MODFLOW Guide
`_.
"""
import sys
import numpy as np
from ..pakbase import Package
from ..utils import Util2d, Util3d
class ModflowSwi2(Package):
"""
MODFLOW SWI2 Package Class.
Parameters
----------
model : model object
The model object (of type :class:`flopy.modflow.mf.Modflow`) to which
this package will be added.
nsrf : int
number of active surfaces (interfaces). This equals the number of zones
minus one. (default is 1).
istrat : int
flag indicating the density distribution. (default is 1).
iswizt : int
unit number for zeta output. (default is None).
ipakcb : int
import os
from ..mbase import BaseModel
from ..pakbase import Package
from ..modflow import Modflow
from ..mt3d import Mt3dms
from .swtvdf import SeawatVdf
from .swtvsc import SeawatVsc
from ..discretization.structuredgrid import StructuredGrid
from flopy.discretization.modeltime import ModelTime
class SeawatList(Package):
"""
List Package class
"""
def __init__(self, model, extension='list', listunit=7):
Package.__init__(self, model, extension, 'LIST', listunit)
return
def __repr__(self):
return 'List package class'
def write_file(self):
# Not implemented for list class
return
model.add_output_file(ipakcb, fname=fname,
package=ModflowRch.ftype())
else:
ipakcb = 0
# Fill namefile items
name = [ModflowRch.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 = 'rch.htm'
self.nrchop = nrchop
self.ipakcb = ipakcb
self.rech = Transient2d(model, (nrow, ncol), np.float32,
rech, name='rech_')
if self.nrchop == 2:
self.irch = Transient2d(model, (nrow, ncol), np.int32,
irch + 1,
name='irch_')
def __init__(self, model, mp_name_file='mp.nam', mp_list_file='mp.list',
option_flags=[1, 2, 1, 1, 1, 2, 2, 1, 2, 1, 1, 1],
ref_time=0, ref_time_per_stp=[0, 0, 1.0], stop_time=None,
group_name=['group_1'], group_placement=[[1, 1, 1, 0, 1, 1]],
release_times=[[1, 1]],
group_region=[[1, 1, 1, 1, 1, 1]], mask_nlay=[1],
mask_layer=[1], mask_1lay=[1], face_ct=[1],
ifaces=[[6, 1, 1]], part_ct=[[1, 1, 1]],
time_ct=1, release_time_incr=1, time_pts=[1],
particle_cell_cnt=[[2, 2, 2]],
cell_bd_ct=1, bud_loc=[[1, 1, 1, 1]], trace_id=1, stop_zone=1,
zone=1, retard_fac=1.0, retard_fcCB=1.0, strt_file=None,
extension='mpsim'):
# Call ancestor's init to set self.parent, extension, name and unit number
Package.__init__(self, model, extension, 'MPSIM', 32)
nrow, ncol, nlay, nper = self.parent.mf.nrow_ncol_nlay_nper
self.heading1 = '# MPSIM for Modpath, generated by Flopy.'
self.heading2 = '#'
self.mp_name_file = '{}.{}'.format(model.name, 'mpnam')
self.mp_list_file = '{}.{}'.format(model.name, 'mplst')
options_list = ['SimulationType', 'TrackingDirection',
'WeakSinkOption', 'WeakSourceOption',
'ReferenceTimeOption', 'StopOption',
'ParticleGenerationOption', 'TimePointOption',
'BudgetOutputOption', 'ZoneArrayOption',
'RetardationOption',
'AdvectiveObservationsOption']
self.option_flags = option_flags
options_dict = dict(list(zip(options_list, option_flags)))
self.options_dict = options_dict
if filenames is None:
filenames = [None]
elif isinstance(filenames, str):
filenames = [filenames]
# Fill namefile items
name = [ModflowSwr1.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 == 'mf2k' or model.version == 'mfusg':
err = 'Error: cannot use {} package with model version {}'.format(
self.name, model.version)
raise Exception(err)
self.heading = '# {} package for '.format(self.name[0]) + \
' {}, '.format(model.version_types[model.version]) + \
'generated by Flopy.'
self.url = 'swr1.htm'
self.parent.add_package(self)
the ModflowFhb class as `flopy.modflow.ModflowFhb`.
Additional information for this MODFLOW package can be found at the `Online
MODFLOW Guide
`_.
"""
import sys
import numpy as np
from ..pakbase import Package
from ..utils.recarray_utils import create_empty_recarray
class ModflowFhb(Package):
"""
MODFLOW Flow and Head Boundary Package Class.
Parameters
----------
model : model object
The model object (of type :class:`flopy.modflow.mf.ModflowFhb`) to
which this package will be added.
nbdtim : int
The number of times at which flow and head will be specified for all
selected cells. (default is 1)
nflw : int
Number of cells at which flows will be specified. (default is 0)
nhed: int
Number of cells at which heads will be specified. (default is 0)
ifhbss : int
def get_empty(ncells=0, aux_names=None, structured=True):
# get an empty recarray that corresponds to dtype
dtype = ModflowGhb.get_default_dtype(structured=structured)
if aux_names is not None:
dtype = Package.add_to_dtype(dtype, aux_names, np.float32)
return create_empty_recarray(ncells, dtype, default_value=-1.0E+10)
vo.dtype, v,
name=vo.name_base,
fmtin=vo.fmtin,
locat=vo.locat))
value = new_list
elif isinstance(old_value[0], Util2d):
new_list = []
for vo, v in zip(old_value, value):
new_list.append(Util2d(self.parent, vo.shape,
vo.dtype, v,
name=vo.name,
fmtin=vo.fmtin,
locat=vo.locat))
value = new_list
super(Package, self).__setattr__(key, value)