コード例 #1
0
ファイル: mfghb.py プロジェクト: joycezw/flopy
    def __init__(self,
                 model,
                 ipakcb=0,
                 stress_period_data=None,
                 dtype=None,
                 no_print=False,
                 options=None,
                 extension='ghb',
                 unitnumber=23):
        """
        Package constructor.

        """
        Package.__init__(self, model, extension, 'GHB', unitnumber)
        self.heading = '# GHB for MODFLOW, generated by Flopy.'
        self.url = 'ghb.htm'
        self.ipakcb = ipakcb  # no cell by cell terms are written
        self.no_print = no_print
        self.np = 0
        if options is None:
            options = []
        if self.no_print:
            options.append('NOPRINT')
        self.options = options
        self.parent.add_package(self)
        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype()
        self.stress_period_data = mflist(model, self.dtype, stress_period_data)
コード例 #2
0
ファイル: mfwel.py プロジェクト: ksl0/flopy
    def __init__(self, model, ipakcb=0, stress_period_data=None, dtype=None,
                 extension='wel', unitnumber=20, options=None):
        """
        Package constructor.

        """
        # Call parent init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'WEL', unitnumber)
        self.heading = '# Well file for MODFLOW, generated by Flopy.'
        self.url = 'wel.htm'
        self.ipakcb = ipakcb  # no cell by cell terms are written
        self.np = 0
        if options is None:
            options = []
        self.specify = False
        for idx, opt in enumerate(options):
            if 'specify' in opt:
                t = opt.strip().split()
                self.specify = True
                self.phiramp = np.float(t[1])
                self.phiramp_unit = np.int(t[2])
                options.pop(idx)
                break
        self.options = options
        self.parent.add_package(self)
        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype(structured=self.parent.structured)
        self.stress_period_data = mflist(model, self.dtype, stress_period_data)
コード例 #3
0
    def __init__(self,
                 model,
                 ipakcb=0,
                 stress_period_data=None,
                 dtype=None,
                 extension='riv',
                 unitnumber=18,
                 options=None,
                 **kwargs):
        """
        Package constructor.

        """
        # Call parent init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'RIV', unitnumber)
        self.heading = '# RIV for MODFLOW, generated by Flopy.'
        self.url = 'riv.htm'
        self.ipakcb = ipakcb
        self.mxactr = 0
        self.np = 0
        if options is None:
            options = []
        self.options = options
        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype(
                structured=self.parent.structured)
        #self.stress_period_data = mflist(model, self.dtype, stress_period_data)
        self.stress_period_data = mflist(self, stress_period_data)
        self.parent.add_package(self)
コード例 #4
0
ファイル: mfdrn.py プロジェクト: joycezw/flopy
    def __init__(self,
                 model,
                 ipakcb=0,
                 stress_period_data=None,
                 dtype=None,
                 extension='drn',
                 unitnumber=21,
                 options=None,
                 **kwargs):
        """
        Package constructor
        """
        Package.__init__(
            self, model, extension, 'DRN', unitnumber
        )  # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = '# DRN for MODFLOW, generated by Flopy.'
        self.url = 'drn.htm'
        self.ipakcb = ipakcb  # 0: no cell by cell terms are written

        self.np = 0
        if options is None:
            options = []
        self.options = options
        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype()
        self.stress_period_data = mflist(model, self.dtype, stress_period_data)
        self.parent.add_package(self)
コード例 #5
0
    def __init__(self, model, ipakcb=0, stress_period_data=None, dtype=None,
                 extension='wel', unitnumber=20, options=None):
        """
        Package constructor.

        """
        # Call parent init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'WEL', unitnumber)
        self.heading = '# Well file for MODFLOW, generated by Flopy.'
        self.url = 'wel.htm'
        self.ipakcb = ipakcb # no cell by cell terms are written
        self.np = 0
        if options is None:
            options = []
        self.specify = False
        for idx, opt in enumerate(options):
            if 'specify' in opt:
                t = opt.strip().split()
                self.specify = True
                self.phiramp = np.float(t[1])
                self.phiramp_unit = np.int(t[2])
                options.pop(idx)
                break
        self.options = options
        self.parent.add_package(self)
        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype()
        self.stress_period_data = mflist(model, self.dtype, stress_period_data)
コード例 #6
0
ファイル: mfchd.py プロジェクト: ksl0/flopy
    def __init__(self, model, stress_period_data=None, dtype=None,
                 extension='chd', unitnumber=24, **kwargs):
        # Call ancestor's init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'CHD', unitnumber)
        self.url = 'chd.htm'
        self.heading = '# CHD for MODFLOW, 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(model, self.dtype, stress_period_data)

        self.np = 0
        self.parent.add_package(self)
コード例 #7
0
ファイル: mfchd.py プロジェクト: joycezw/flopy
    def __init__(self,
                 model,
                 stress_period_data=None,
                 dtype=None,
                 extension='chd',
                 unitnumber=24,
                 **kwargs):
        # Call ancestor's init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'CHD', unitnumber)
        self.url = 'chd.htm'
        self.heading = '# CHD for MODFLOW, generated by Flopy.'

        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype()
        self.stress_period_data = mflist(model, self.dtype, stress_period_data)

        self.np = 0
        self.parent.add_package(self)
コード例 #8
0
ファイル: mfdrn.py プロジェクト: arkottke/flopy
    def __init__(self, model, ipakcb=0, stress_period_data=None, dtype=None,
                 extension ='drn', unitnumber=21, options=None, **kwargs):
        """
        Package constructor
        """
        Package.__init__(self, model, extension, 'DRN', unitnumber) # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = '# DRN for MODFLOW, generated by Flopy.'
        self.url = 'drn.htm'
        self.ipakcb = ipakcb  # 0: no cell by cell terms are written

        self.np = 0
        if options is None:
            options = []
        self.options = options
        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype()
        self.stress_period_data = mflist(model, self.dtype, stress_period_data)
        self.parent.add_package(self)
コード例 #9
0
ファイル: mfriv.py プロジェクト: arkottke/flopy
    def __init__(self, model, ipakcb=0, stress_period_data=None,dtype=None,
                 extension ='riv', unitnumber=18, options=None,**kwargs):
        """
        Package constructor.

        """
        # Call parent init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'RIV', unitnumber)
        self.heading = '# RIV for MODFLOW, generated by Flopy.'
        self.url = 'riv.htm'
        self.ipakcb = ipakcb
        self.mxactr = 0
        self.np = 0
        if options is None:
            options = []
        self.options = options
        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype()
        self.stress_period_data = mflist(model,self.dtype,stress_period_data)
        self.parent.add_package(self)
コード例 #10
0
ファイル: mfghb.py プロジェクト: ksl0/flopy
    def __init__(self, model, ipakcb=0, stress_period_data=None, dtype=None,
                 no_print=False, options=None, extension='ghb', unitnumber=23):
        """
        Package constructor.

        """
        Package.__init__(self, model, extension, 'GHB',
                         unitnumber)
        self.heading = '# GHB for MODFLOW, generated by Flopy.'
        self.url = 'ghb.htm'
        self.ipakcb = ipakcb  # no cell by cell terms are written
        self.no_print = no_print
        self.np = 0
        if options is None:
            options = []
        if self.no_print:
            options.append('NOPRINT')
        self.options = options
        self.parent.add_package(self)
        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype(structured=self.parent.structured)
        self.stress_period_data = mflist(model, self.dtype, stress_period_data)
コード例 #11
0
ファイル: mtssm.py プロジェクト: nixnfg/integrated
    def __init__(self, model, crch = None, cevt = None,
                 stress_period_data = None, dtype = None,
                 extension = 'ssm',
                 **kwargs):
        # Call ancestor's init to set self.parent, extension, name and
        # unit number
        Package.__init__(self, model, extension, 'SSM', 34)

        deprecated_kwargs = ['criv', 'cghb', 'cibd', 'cchd', 'cpbc', 'cwel'] 
        for key in kwargs:
            if (key in deprecated_kwargs):
                warnings.warn("Deprecation Warning: Keyword argument '" + key +
                              "' no longer supported. Use " +
                              "'stress_period_data' instead.")
                
        nrow, ncol, nlay, nper = self.parent.mf.nrow_ncol_nlay_nper
        # ncomp > 1 support
        ncomp = self.parent.get_ncomp()

        self.__SsmPackages = []
        for i, label in enumerate(SsmLabels):
            self.__SsmPackages.append(SsmPackage(label, 
                               self.parent.mf.get_package(label),
                               (i < 6))) # First 6 need T/F flag in file line 1

        self.__maxssm = 0
        #if (self.parent.btn.icbund != None):
        if isinstance(self.parent.btn.icbund, np.ndarray):
            self.maxssm = (self.parent.btn.icbund < 0).sum()
        for p in self.__SsmPackages:
            if ((p.label == 'BAS6') and (p.instance != None)):
                self.__maxssm += (p.instance.ibound < 0).sum()
            elif p.instance != None:
                self.__maxssm += p.instance.ncells()
        
        # Note: list is used for multi-species, NOT for stress periods!        
        if (crch != None):
            self.crch = []
            t2d = transient_2d(model, (nrow, ncol), np.float32,
                               crch, name='crch1',
                               locat=self.unit_number[0])
            self.crch.append(t2d)
            if ncomp > 1:
                for icomp in range(2, ncomp+1):
                    val = 0.0
                    name = "crch" + str(icomp)
                    if name in list(kwargs.keys()):
                        val = kwargs[name]
                        kwargs.pop(name)
                    else:
                        print("SSM: setting crch for component " +\
                              str(icomp) + " to zero. kwarg name " +\
                              name)
                    t2d = transient_2d(model, (nrow, ncol), np.float32,
                                       val, name=name,
                                       locat=self.unit_number[0])
                    self.crch.append(t2d)
        else:
            self.crch = None

        if (cevt != None):
            self.cevt = []
            t2d = transient_2d(model, (nrow, ncol), np.float32,
                               cevt, name='cevt1',
                               locat=self.unit_number[0])
            self.cevt.append(t2d)
            if ncomp > 1:
                for icomp in range(2, ncomp+1):
                    val = 0.0
                    name = "cevt" + str(icomp)
                    if name in list(kwargs.keys()):
                        val = kwargs[name]
                        kwargs.pop(name)
                    else:
                        print("SSM: setting cevt for component " +\
                              str(icomp) + " to zero, kwarg name " +\
                              name)
                    t2d = transient_2d(model, (nrow, ncol), np.float32,
                                       val, name=name,
                                       locat=self.unit_number[0])
                    self.cevt.append(t2d)

        else:
            self.cevt = None

        if len(list(kwargs.keys())) > 0:
            raise Exception("SSM error: unrecognized kwargs: " +
                            ' '.join(list(kwargs.keys())))

        if dtype is not None:
            self.dtype = dtype
        else:

            self.dtype = self.get_default_dtype(ncomp)
  
        self.stress_period_data = mflist(self, model=self.parent.mf,
                                         data=stress_period_data)

        #Add self to parent and return
        self.parent.add_package(self)
        return