Beispiel #1
0
    def load(f, model, ext_unit_dict=None):
        """
        Load an existing package.

        Parameters
        ----------
        f : filename or file handle
            File to load.
        model : model object
            The model object (of type :class:`flopy.modflow.mf.Modflow`) to
            which this package will be added.
        ext_unit_dict : dictionary, optional
            If the arrays in the file are specified using EXTERNAL,
            or older style array control records, then `f` should be a file
            handle.  In this case ext_unit_dict is required, which can be
            constructed using the function
            :class:`flopy.utils.mfreadnam.parsenamefile`.

        Returns
        -------
        dis : ModflowUPW object
            ModflowLpf object.

        Examples
        --------

        >>> import flopy
        >>> m = flopy.modflow.Modflow()
        >>> lpf = flopy.modflow.ModflowUpw.load('test.upw', m)

        """

        if model.verbose:
            sys.stdout.write('loading upw package file...\n')

        if not hasattr(f, 'read'):
            filename = f
            f = open(filename, 'r')
        #dataset 0 -- header
        while True:
            line = f.readline()
            if line[0] != '#':
                break
        # determine problem dimensions
        nrow, ncol, nlay, nper = model.get_nrow_ncol_nlay_nper()
        # Item 1: IBCFCB, HDRY, NPLPF - line already read above
        if model.verbose:
            print('   loading IUPWCB, HDRY, NPUPW, IPHDRY...')
        t = line.strip().split()
        iupwcb, hdry, npupw, iphdry = int(t[0]), float(t[1]), int(t[2]), int(t[3])
        if iupwcb != 0:
            model.add_pop_key_list(iupwcb)
            iupwcb = 53
        # options
        noparcheck = False
        if len(t) > 3:
            for k in range(3,len(t)):
                if 'NOPARCHECK' in t[k].upper():
                    noparcheck = True
        # LAYTYP array
        if model.verbose:
            print('   loading LAYTYP...')
        line = f.readline()
        t = line.strip().split()
        laytyp = np.array((t[0:nlay]),dtype=np.int)
        # LAYAVG array
        if model.verbose:
            print('   loading LAYAVG...')
        line = f.readline()
        t = line.strip().split()
        layavg = np.array((t[0:nlay]),dtype=np.int)
        # CHANI array
        if model.verbose:
            print('   loading CHANI...')
        line = f.readline()
        t = line.strip().split()
        chani = np.array((t[0:nlay]),dtype=np.float32)
        # LAYVKA array
        if model.verbose:
            print('   loading LAYVKA...')
        line = f.readline()
        t = line.strip().split()
        layvka = np.array((t[0:nlay]),dtype=np.int)
        # LAYWET array
        if model.verbose:
            print('   loading LAYWET...')
        line = f.readline()
        t = line.strip().split()
        laywet = np.array((t[0:nlay]),dtype=np.int)
        # Item 7: WETFCT, IWETIT, IHDWET
        wetfct,iwetit,ihdwet = None,None,None
        iwetdry = laywet.sum()
        if iwetdry > 0:
            raise Exception('LAYWET should be 0 for UPW')

        #--get parameters
        par_types = []
        if npupw > 0:
            par_types, parm_dict = mfpar.load(f, nplpf, model.verbose)

        #--get arrays
        transient = not model.get_package('DIS').steady.all()
        hk = [0] * nlay
        hani = [0] * nlay
        vka = [0] * nlay
        ss = [0] * nlay
        sy = [0] * nlay
        vkcb = [0] * nlay
        for k in range(nlay):
            if model.verbose:
                print('   loading hk layer {0:3d}...'.format(k+1))
            if 'hk' not in par_types:
                t = util_2d.load(f, model, (nrow,ncol), np.float32, 'hk',
                                 ext_unit_dict)
            else:
                line = f.readline()
                t = mfpar.parameter_fill(model, (nrow, ncol), 'hk', parm_dict, findlayer=k)
            hk[k] = t
            if chani[k] < 1:
                if model.verbose:
                    print('   loading hani layer {0:3d}...'.format(k+1))
                if 'hani' not in par_types:
                    t = util_2d.load(f, model, (nrow,ncol), np.float32, 'hani',
                                     ext_unit_dict)
                else:
                    line = f.readline()
                    t = mfpar.parameter_fill(model, (nrow, ncol), 'hani', parm_dict, findlayer=k)
                hani[k] = t
            if model.verbose:
                print('   loading vka layer {0:3d}...'.format(k+1))
            if 'vka' not in par_types and 'vani' not in par_types:
                t = util_2d.load(f, model, (nrow,ncol), np.float32, 'vka',
                                 ext_unit_dict)
            else:
                line = f.readline()
                t = mfpar.parameter_fill(model, (nrow, ncol), 'vka', parm_dict, findlayer=k)
            vka[k] = t
            if transient:
                if model.verbose:
                    print('   loading ss layer {0:3d}...'.format(k+1))
                if 'ss' not in par_types:
                    t = util_2d.load(f, model, (nrow,ncol), np.float32, 'ss',
                                     ext_unit_dict)
                else:
                    line = f.readline()
                    t = mfpar.parameter_fill(model, (nrow, ncol), 'ss', parm_dict, findlayer=k)
                ss[k] = t
                if laytyp[k] != 0:
                    if model.verbose:
                        print('   loading sy layer {0:3d}...'.format(k+1))
                    if 'sy' not in par_types:
                        t = util_2d.load(f, model, (nrow,ncol), np.float32, 'sy',
                                         ext_unit_dict)
                    else:
                        line = f.readline()
                        t = mfpar.parameter_fill(model, (nrow, ncol), 'sy', parm_dict, findlayer=k)
                    sy[k] = t
            if model.get_package('DIS').laycbd[k] > 0:
                if model.verbose:
                    print('   loading vkcb layer {0:3d}...'.format(k+1))
                if 'vkcb' not in par_types:
                    t = util_2d.load(f, model, (nrow,ncol), np.float32, 'vkcb',
                                     ext_unit_dict)
                else:
                    line = f.readline()
                    t = mfpar.parameter_fill(model, (nrow, ncol), 'vkcb', parm_dict, findlayer=k)
                vkcb[k] = t

        #--create upw object
        upw = ModflowUpw(model, iupwcb=iupwcb, iphdry=iphdry, hdry=hdry,
                         noparcheck=noparcheck,
                         laytyp=laytyp, layavg=layavg, chani=chani,
                         layvka=layvka, laywet=laywet,
                         hk=hk, hani=hani, vka=vka, ss=ss, sy=sy, vkcb=vkcb)

        #--return upw object
        return upw
Beispiel #2
0
    def load(f, model, ext_unit_dict=None):
        """
        Load an existing package.

        Parameters
        ----------
        f : filename or file handle
            File to load.
        model : model object
            The model object (of type :class:`flopy.modflow.mf.Modflow`) to
            which this package will be added.
        ext_unit_dict : dictionary, optional
            If the arrays in the file are specified using EXTERNAL,
            or older style array control records, then `f` should be a file
            handle.  In this case ext_unit_dict is required, which can be
            constructed using the function
            :class:`flopy.utils.mfreadnam.parsenamefile`.

        Returns
        -------
        dis : ModflowUPW object
            ModflowLpf object.

        Examples
        --------

        >>> import flopy
        >>> m = flopy.modflow.Modflow()
        >>> lpf = flopy.modflow.ModflowUpw.load('test.upw', m)

        """

        if model.verbose:
            sys.stdout.write('loading upw package file...\n')

        if type(f) is not file:
            filename = f
            f = open(filename, 'r')
        #dataset 0 -- header
        while True:
            line = f.readline()
            if line[0] != '#':
                break
        # determine problem dimensions
        nrow, ncol, nlay, nper = model.get_nrow_ncol_nlay_nper()
        # Item 1: IBCFCB, HDRY, NPLPF - line already read above
        if model.verbose:
            print '   loading IUPWCB, HDRY, NPUPW, IPHDRY...'
        t = line.strip().split()
        iupwcb, hdry, npupw, iphdry = int(t[0]), float(t[1]), int(t[2]), int(t[3])
        if iupwcb != 0:
            model.add_pop_key_list(iupwcb)
            iupwcb = 53
        # options
        noparcheck = False
        if len(t) > 3:
            for k in xrange(3,len(t)):
                if 'NOPARCHECK' in t[k].upper():
                    noparcheck = True
        # LAYTYP array
        if model.verbose:
            print '   loading LAYTYP...'
        line = f.readline()
        t = line.strip().split()
        laytyp = np.array((t[0:nlay]),dtype=np.int)
        # LAYAVG array
        if model.verbose:
            print '   loading LAYAVG...'
        line = f.readline()
        t = line.strip().split()
        layavg = np.array((t[0:nlay]),dtype=np.int)
        # CHANI array
        if model.verbose:
            print '   loading CHANI...'
        line = f.readline()
        t = line.strip().split()
        chani = np.array((t[0:nlay]),dtype=np.float32)
        # LAYVKA array
        if model.verbose:
            print '   loading LAYVKA...'
        line = f.readline()
        t = line.strip().split()
        layvka = np.array((t[0:nlay]),dtype=np.int)
        # LAYWET array
        if model.verbose:
            print '   loading LAYWET...'
        line = f.readline()
        t = line.strip().split()
        laywet = np.array((t[0:nlay]),dtype=np.int)
        # Item 7: WETFCT, IWETIT, IHDWET
        wetfct,iwetit,ihdwet = None,None,None
        iwetdry = laywet.sum()
        if iwetdry > 0:
            raise Exception, 'LAYWET should be 0 for UPW'

        #--get parameters
        par_types = []
        if npupw > 0:
            par_types, parm_dict = mfpar.load(f, nplpf, model.verbose)

        #--get arrays
        transient = not model.get_package('DIS').steady.all()
        hk = [0] * nlay
        hani = [0] * nlay
        vka = [0] * nlay
        ss = [0] * nlay
        sy = [0] * nlay
        vkcb = [0] * nlay
        for k in range(nlay):
            if model.verbose:
                print '   loading hk layer {0:3d}...'.format(k+1)
            if 'hk' not in par_types:
                t = util_2d.load(f, model, (nrow,ncol), np.float32, 'hk',
                                 ext_unit_dict)
            else:
                line = f.readline()
                t = mfpar.parameter_fill(model, (nrow, ncol), 'hk', parm_dict, findlayer=k)
            hk[k] = t
            if chani[k] < 1:
                if model.verbose:
                    print '   loading hani layer {0:3d}...'.format(k+1)
                if 'hani' not in par_types:
                    t = util_2d.load(f, model, (nrow,ncol), np.float32, 'hani',
                                     ext_unit_dict)
                else:
                    line = f.readline()
                    t = mfpar.parameter_fill(model, (nrow, ncol), 'hani', parm_dict, findlayer=k)
                hani[k] = t
            if model.verbose:
                print '   loading vka layer {0:3d}...'.format(k+1)
            if 'vka' not in par_types and 'vani' not in par_types:
                t = util_2d.load(f, model, (nrow,ncol), np.float32, 'vka',
                                 ext_unit_dict)
            else:
                line = f.readline()
                t = mfpar.parameter_fill(model, (nrow, ncol), 'vka', parm_dict, findlayer=k)
            vka[k] = t
            if transient:
                if model.verbose:
                    print '   loading ss layer {0:3d}...'.format(k+1)
                if 'ss' not in par_types:
                    t = util_2d.load(f, model, (nrow,ncol), np.float32, 'ss',
                                     ext_unit_dict)
                else:
                    line = f.readline()
                    t = mfpar.parameter_fill(model, (nrow, ncol), 'ss', parm_dict, findlayer=k)
                ss[k] = t
                if laytyp[k] != 0:
                    if model.verbose:
                        print '   loading sy layer {0:3d}...'.format(k+1)
                    if 'sy' not in par_types:
                        t = util_2d.load(f, model, (nrow,ncol), np.float32, 'sy',
                                         ext_unit_dict)
                    else:
                        line = f.readline()
                        t = mfpar.parameter_fill(model, (nrow, ncol), 'sy', parm_dict, findlayer=k)
                    sy[k] = t
            if model.get_package('DIS').laycbd[k] > 0:
                if model.verbose:
                    print '   loading vkcb layer {0:3d}...'.format(k+1)
                if 'vkcb' not in par_types:
                    t = util_2d.load(f, model, (nrow,ncol), np.float32, 'vkcb',
                                     ext_unit_dict)
                else:
                    line = f.readline()
                    t = mfpar.parameter_fill(model, (nrow, ncol), 'vkcb', parm_dict, findlayer=k)
                vkcb[k] = t

        #--create upw object
        upw = ModflowUpw(model, iupwcb=iupwcb, iphdry=iphdry, hdry=hdry,
                         noparcheck=noparcheck,
                         laytyp=laytyp, layavg=layavg, chani=chani,
                         layvka=layvka, laywet=laywet,
                         hk=hk, hani=hani, vka=vka, ss=ss, sy=sy, vkcb=vkcb)

        #--return upw object
        return upw
Beispiel #3
0
    def load(f, model, ext_unit_dict=None):
        """
        Load an existing package.

        Parameters
        ----------
        f : filename or file handle
            File to load.
        model : model object
            The model object (of type :class:`flopy.modflow.mf.Modflow`) to
            which this package will be added.
        ext_unit_dict : dictionary, optional
            If the arrays in the file are specified using EXTERNAL,
            or older style array control records, then `f` should be a file
            handle.  In this case ext_unit_dict is required, which can be
            constructed using the function
            :class:`flopy.utils.mfreadnam.parsenamefile`.

        Returns
        -------
        dis : ModflowLpf object
            ModflowLpf object.

        Examples
        --------

        >>> import flopy
        >>> m = flopy.modflow.Modflow()
        >>> lpf = flopy.modflow.ModflowLpf.load('test.lpf', m)

        """

        if model.verbose:
            sys.stdout.write('loading lpf package file...\n')

        if type(f) is not file:
            filename = f
            f = open(filename, 'r')
        #dataset 0 -- header
        while True:
            line = f.readline()
            if line[0] != '#':
                break
        # determine problem dimensions
        nrow, ncol, nlay, nper = model.get_nrow_ncol_nlay_nper()
        # Item 1: IBCFCB, HDRY, NPLPF - line already read above
        if model.verbose:
            print '   loading IBCFCB, HDRY, NPLPF...'
        t = line.strip().split()
        ilpfcb, hdry, nplpf = int(t[0]), float(t[1]), int(t[2])
        if ilpfcb != 0:
            model.add_pop_key_list(ilpfcb)
            ilpfcb = 53
        # options
        storagecoefficient = False
        constantcv = False
        thickstrt = False
        nocvcorrection = False
        novfc = False
        if len(t) > 3:
            for k in xrange(3, len(t)):
                if 'STORAGECOEFFICIENT' in t[k].upper():
                    storagecoefficient = True
                elif 'CONSTANTCV' in t[k].upper():
                    constantcv = True
                elif 'THICKSTRT' in t[k].upper():
                    thickstrt = True
                elif 'NOCVCORRECTION' in t[k].upper():
                    nocvcorrection = True
                elif 'NOVFC' in t[k].upper():
                    novfc = True
        # LAYTYP array
        if model.verbose:
            print '   loading LAYTYP...'
        laytyp = np.empty((nlay), dtype=np.int)
        laytyp = read1d(f, laytyp)
        # LAYAVG array
        if model.verbose:
            print '   loading LAYAVG...'
        layavg = np.empty((nlay), dtype=np.int)
        layavg = read1d(f, layavg)
        # CHANI array
        if model.verbose:
            print '   loading CHANI...'
        chani = np.empty((nlay), dtype=np.float32)
        chani = read1d(f, chani)
        # LAYVKA array
        if model.verbose:
            print '   loading LAYVKA...'
        layvka = np.empty((nlay), dtype=np.float32)
        layvka = read1d(f, layvka)
        # LAYWET array
        if model.verbose:
            print '   loading LAYWET...'
        laywet = np.empty((nlay), dtype=np.int)
        laywet = read1d(f, laywet)
        # Item 7: WETFCT, IWETIT, IHDWET
        wetfct, iwetit, ihdwet = None, None, None
        iwetdry = laywet.sum()
        if iwetdry > 0:
            if model.verbose:
                print '   loading WETFCT, IWETIT, IHDWET...'
            line = f.readline()
            t = line.strip().split()
            wetfct, iwetit, ihdwet = float(t[0]), int(t[1]), int(t[2])

        #--parameters data
        par_types = []
        if nplpf > 0:
            par_types, parm_dict = mfpar.load(f, nplpf, model.verbose)
            #print parm_dict

        #--non-parameter data
        transient = not model.get_package('DIS').steady.all()
        hk = [0] * nlay
        hani = [0] * nlay
        vka = [0] * nlay
        ss = [0] * nlay
        sy = [0] * nlay
        vkcb = [0] * nlay
        wetdry = [0] * nlay
        for k in range(nlay):
            if model.verbose:
                print '   loading hk layer {0:3d}...'.format(k + 1)
            if 'hk' not in par_types:
                t = util_2d.load(f, model, (nrow, ncol), np.float32, 'hk',
                                 ext_unit_dict)
            else:
                line = f.readline()
                t = mfpar.parameter_fill(model, (nrow, ncol),
                                         'hk',
                                         parm_dict,
                                         findlayer=k)
            hk[k] = t
            if chani[k] < 0:
                if model.verbose:
                    print '   loading hani layer {0:3d}...'.format(k + 1)
                if 'hani' not in par_types:
                    t = util_2d.load(f, model, (nrow, ncol), np.float32,
                                     'hani', ext_unit_dict)
                else:
                    line = f.readline()
                    t = mfpar.parameter_fill(model, (nrow, ncol),
                                             'hani',
                                             parm_dict,
                                             findlayer=k)
                hani[k] = t
            if model.verbose:
                print '   loading vka layer {0:3d}...'.format(k + 1)
            if 'vka' not in par_types and 'vani' not in par_types:
                t = util_2d.load(f, model, (nrow, ncol), np.float32, 'vka',
                                 ext_unit_dict)
            else:
                line = f.readline()
                t = mfpar.parameter_fill(model, (nrow, ncol),
                                         'vka',
                                         parm_dict,
                                         findlayer=k)
            vka[k] = t
            if transient:
                if model.verbose:
                    print '   loading ss layer {0:3d}...'.format(k + 1)
                if 'ss' not in par_types:
                    t = util_2d.load(f, model, (nrow, ncol), np.float32, 'ss',
                                     ext_unit_dict)
                else:
                    line = f.readline()
                    t = mfpar.parameter_fill(model, (nrow, ncol),
                                             'ss',
                                             parm_dict,
                                             findlayer=k)
                ss[k] = t
                if laytyp[k] != 0:
                    if model.verbose:
                        print '   loading sy layer {0:3d}...'.format(k + 1)
                    if 'sy' not in par_types:
                        t = util_2d.load(f, model, (nrow, ncol), np.float32,
                                         'sy', ext_unit_dict)
                    else:
                        line = f.readline()
                        t = mfpar.parameter_fill(model, (nrow, ncol),
                                                 'sy',
                                                 parm_dict,
                                                 findlayer=k)
                    sy[k] = t
            #if self.parent.get_package('DIS').laycbd[k] > 0:
            if model.get_package('DIS').laycbd[k] > 0:
                if model.verbose:
                    print '   loading vkcb layer {0:3d}...'.format(k + 1)
                if 'vkcb' not in par_types:
                    t = util_2d.load(f, model, (nrow, ncol), np.float32,
                                     'vkcb', ext_unit_dict)
                else:
                    line = f.readline()
                    t = mfpar.parameter_fill(model, (nrow, ncol),
                                             'vkcb',
                                             parm_dict,
                                             findlayer=k)
                vkcb[k] = t
            if (laywet[k] != 0 and laytyp[k] != 0):
                if model.verbose:
                    print '   loading wetdry layer {0:3d}...'.format(k + 1)
                t = util_2d.load(f, model, (nrow, ncol), np.float32, 'wetdry',
                                 ext_unit_dict)
                wetdry[k] = t

        #--create instance of lpf class
        lpf = ModflowLpf(model,
                         ilpfcb=ilpfcb,
                         laytyp=laytyp,
                         layavg=layavg,
                         chani=chani,
                         laywet=laywet,
                         hdry=hdry,
                         iwdflg=iwetdry,
                         wetfct=wetfct,
                         iwetit=iwetit,
                         ihdwet=ihdwet,
                         hk=hk,
                         hani=hani,
                         vka=vka,
                         ss=ss,
                         sy=sy,
                         vkcb=vkcb,
                         wetdry=wetdry,
                         storagecoefficient=storagecoefficient,
                         constantcv=constantcv,
                         thickstrt=thickstrt,
                         novfc=novfc)
        return lpf
Beispiel #4
0
    def __init__(self, modelname='modflowtest', namefile_ext='nam',
                 version='mf2005', exe_name='mf2005.exe',
                 structured=True,
                 listunit=2, model_ws='.', external_path=None,
                 verbose=False, load=True, silent=0):
        BaseModel.__init__(self, modelname, namefile_ext, exe_name, model_ws, structured=structured)
        version_types = ('mf2k', 'mf2005', 'mfnwt', 'mfusg')
        self.heading = '# Name file for ' + version + ', generated by Flopy.'
        self.version = version.lower()
        if self.version == 'mf2k':
            self.glo = ModflowGlobal(self)
        self.lst = ModflowList(self, unitnumber=listunit)
        # -- check if unstructured is specified for something
        #    other than mfusg is specified
        if not self.structured:
            assert 'mfusg' in self.version, 'structured=False can only be specified for mfusg models'

        # external option stuff
        self.free_format = True
        self.external_fnames = []
        self.external_units = []
        self.external_binflag = []
        self.external = False
        self.verbose = verbose
        self.load = load
        # the starting external data unit number
        self.__next_ext_unit = 1000
        if external_path is not None:
            assert model_ws == '.', "ERROR: external cannot be used " +\
                "with model_ws"

            #external_path = os.path.join(model_ws, external_path)
            if os.path.exists(external_path):
                print("Note: external_path " + str(external_path) +
                    " already exists")
            #assert os.path.exists(external_path),'external_path does not exist'
            else:
                os.mkdir(external_path)
            self.external = True
        self.external_path = external_path
        self.verbose = verbose
        self.silent = silent
        self.mfpar = ModflowPar()

        # Create a dictionary to map package with package object.
        # This is used for loading models.
        self.mfnam_packages = {
            "zone": flopy.modflow.ModflowZon,
            "mult": flopy.modflow.ModflowMlt,
            "pval": flopy.modflow.ModflowPval,
            "bas6": flopy.modflow.ModflowBas,
            "dis": flopy.modflow.ModflowDis,
            "lpf": flopy.modflow.ModflowLpf,
            "hfb6": flopy.modflow.ModflowHfb,
            "chd": flopy.modflow.ModflowChd,
            "wel": flopy.modflow.ModflowWel,
            "drn": flopy.modflow.ModflowDrn,
            "rch": flopy.modflow.ModflowRch,
            "evt": flopy.modflow.ModflowEvt,
            "ghb": flopy.modflow.ModflowGhb,
            "gmg": flopy.modflow.ModflowGmg,
            "riv": flopy.modflow.ModflowRiv,
            "swi2": flopy.modflow.ModflowSwi2,
            "pcg": flopy.modflow.ModflowPcg,
            "pcgn": flopy.modflow.ModflowPcgn,
            "nwt": flopy.modflow.ModflowNwt,
            "pks": flopy.modflow.ModflowPks,
            "sip": flopy.modflow.ModflowSip,
            "sor": flopy.modflow.ModflowSor,
            "oc": flopy.modflow.ModflowOc,
            "uzf": flopy.modflow.ModflowUzf1,
            "upw": flopy.modflow.ModflowUpw
            }
        return
Beispiel #5
0
    def load(f, model, ext_unit_dict=None):
        """
        Load an existing package.

        Parameters
        ----------
        f : filename or file handle
            File to load.
        model : model object
            The model object (of type :class:`flopy.modflow.mf.Modflow`) to
            which this package will be added.
        ext_unit_dict : dictionary, optional
            If the arrays in the file are specified using EXTERNAL,
            or older style array control records, then `f` should be a file
            handle.  In this case ext_unit_dict is required, which can be
            constructed using the function
            :class:`flopy.utils.mfreadnam.parsenamefile`.

        Returns
        -------
        dis : ModflowLpf object
            ModflowLpf object.

        Examples
        --------

        >>> import flopy
        >>> m = flopy.modflow.Modflow()
        >>> lpf = flopy.modflow.ModflowLpf.load('test.lpf', m)

        """

        if model.verbose:
            sys.stdout.write('loading lpf package file...\n')

        if not hasattr(f, 'read'):
            filename = f
            f = open(filename, 'r')
        #dataset 0 -- header
        while True:
            line = f.readline()
            if line[0] != '#':
                break
        # determine problem dimensions
        nrow, ncol, nlay, nper = model.get_nrow_ncol_nlay_nper()
        # Item 1: IBCFCB, HDRY, NPLPF - line already read above
        if model.verbose:
            print('   loading IBCFCB, HDRY, NPLPF...')
        t = line.strip().split()
        ilpfcb, hdry, nplpf = int(t[0]), float(t[1]), int(t[2])
        if ilpfcb != 0:
            model.add_pop_key_list(ilpfcb)
            ilpfcb = 53
        # options
        storagecoefficient = False
        constantcv = False
        thickstrt = False
        nocvcorrection = False
        novfc = False
        if len(t) > 3:
            for k in range(3,len(t)):
                if 'STORAGECOEFFICIENT' in t[k].upper():
                    storagecoefficient = True
                elif 'CONSTANTCV' in t[k].upper():
                    constantcv = True
                elif 'THICKSTRT' in t[k].upper():
                    thickstrt = True
                elif 'NOCVCORRECTION' in t[k].upper():
                    nocvcorrection = True
                elif 'NOVFC' in t[k].upper():
                    novfc = True
        # LAYTYP array
        if model.verbose:
            print('   loading LAYTYP...')
        laytyp = np.empty((nlay), dtype=np.int)
        laytyp = read1d(f, laytyp)
        # LAYAVG array
        if model.verbose:
            print('   loading LAYAVG...')
        layavg = np.empty((nlay), dtype=np.int)
        layavg = read1d(f, layavg)
        # CHANI array
        if model.verbose:
            print('   loading CHANI...')
        chani = np.empty((nlay), dtype=np.float32)
        chani = read1d(f, chani)
        # LAYVKA array
        if model.verbose:
            print('   loading LAYVKA...')
        layvka = np.empty((nlay), dtype=np.float32)
        layvka = read1d(f, layvka)
        # LAYWET array
        if model.verbose:
            print('   loading LAYWET...')
        laywet = np.empty((nlay), dtype=np.int)
        laywet = read1d(f, laywet)
        # Item 7: WETFCT, IWETIT, IHDWET
        wetfct,iwetit,ihdwet = None, None, None
        iwetdry = laywet.sum()
        if iwetdry > 0:
            if model.verbose:
                print('   loading WETFCT, IWETIT, IHDWET...')
            line = f.readline()
            t = line.strip().split()
            wetfct, iwetit, ihdwet = float(t[0]), int(t[1]), int(t[2])

        # parameters data
        par_types = []
        if nplpf > 0:
            par_types, parm_dict = mfpar.load(f, nplpf, model.verbose)
            #print parm_dict

        # non-parameter data
        transient = not model.get_package('DIS').steady.all()
        hk = [0] * nlay
        hani = [0] * nlay
        vka = [0] * nlay
        ss = [0] * nlay
        sy = [0] * nlay
        vkcb = [0] * nlay
        wetdry = [0] * nlay
        for k in range(nlay):
            if model.verbose:
                print('   loading hk layer {0:3d}...'.format(k+1))
            if 'hk' not in par_types:
                t = util_2d.load(f, model, (nrow,ncol), np.float32, 'hk',
                                 ext_unit_dict)
            else:
                line = f.readline()
                t = mfpar.parameter_fill(model, (nrow, ncol), 'hk', parm_dict, findlayer=k)
            hk[k] = t
            if chani[k] < 0:
                if model.verbose:
                    print('   loading hani layer {0:3d}...'.format(k+1))
                if 'hani' not in par_types:
                    t = util_2d.load(f, model, (nrow, ncol), np.float32, 'hani',
                                     ext_unit_dict)
                else:
                    line = f.readline()
                    t = mfpar.parameter_fill(model, (nrow, ncol), 'hani', parm_dict, findlayer=k)
                hani[k] = t
            if model.verbose:
                print('   loading vka layer {0:3d}...'.format(k+1))
            if 'vka' not in par_types and 'vani' not in par_types:
                t = util_2d.load(f, model, (nrow, ncol), np.float32, 'vka',
                                 ext_unit_dict)
            else:
                line = f.readline()
                key = 'vka'
                if 'vani' in par_types:
                    key = 'vani'
                t = mfpar.parameter_fill(model, (nrow, ncol), key, parm_dict, findlayer=k)
            vka[k] = t
            if transient:
                if model.verbose:
                    print('   loading ss layer {0:3d}...'.format(k+1))
                if 'ss' not in par_types:
                    t = util_2d.load(f, model, (nrow, ncol), np.float32, 'ss',
                                     ext_unit_dict)
                else:
                    line = f.readline()
                    t = mfpar.parameter_fill(model, (nrow, ncol), 'ss', parm_dict, findlayer=k)
                ss[k] = t
                if laytyp[k] != 0:
                    if model.verbose:
                        print('   loading sy layer {0:3d}...'.format(k+1))
                    if 'sy' not in par_types:
                        t = util_2d.load(f, model, (nrow, ncol), np.float32, 'sy',
                                         ext_unit_dict)
                    else:
                        line = f.readline()
                        t = mfpar.parameter_fill(model, (nrow, ncol), 'sy', parm_dict, findlayer=k)
                    sy[k] = t
            #if self.parent.get_package('DIS').laycbd[k] > 0:
            if model.get_package('DIS').laycbd[k] > 0:
                if model.verbose:
                    print('   loading vkcb layer {0:3d}...'.format(k+1))
                if 'vkcb' not in par_types:
                    t = util_2d.load(f, model, (nrow, ncol), np.float32, 'vkcb',
                                     ext_unit_dict)
                else:
                    line = f.readline()
                    t = mfpar.parameter_fill(model, (nrow, ncol), 'vkcb', parm_dict, findlayer=k)
                vkcb[k] = t
            if (laywet[k] != 0 and laytyp[k] != 0):
                if model.verbose:
                    print('   loading wetdry layer {0:3d}...'.format(k+1))
                t = util_2d.load(f, model, (nrow, ncol), np.float32, 'wetdry',
                                 ext_unit_dict)
                wetdry[k] = t

        # create instance of lpf class
        lpf = ModflowLpf(model, ilpfcb=ilpfcb, laytyp=laytyp, layavg=layavg, chani=chani,
                         layvka=layvka, laywet=laywet, hdry=hdry, iwdflg=iwetdry,
                         wetfct=wetfct, iwetit=iwetit, ihdwet=ihdwet,
                         hk=hk, hani=hani, vka=vka, ss=ss, sy=sy, vkcb=vkcb,
                         wetdry=wetdry, storagecoefficient=storagecoefficient,
                         constantcv=constantcv,thickstrt=thickstrt,novfc=novfc)
        return lpf