How to use the flopy.utils.Util2d.load function in flopy

To help you get started, we’ve selected a few flopy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github modflowpy / flopy / flopy / mt3d / mtsft.py View on Github external
if model.free_format:
                print('   Using MODFLOW style array reader utilities to ' \
                      'read DISPSF')
            elif model.array_format == 'mt3d':
                print('   Using historic MT3DMS array reader utilities to ' \
                      'read DISPSF')

        dispsf = Util2d.load(f, model, (np.abs(nsfinit),), np.float32,
                             'dispsf1',
                             ext_unit_dict, array_format=model.array_format)
        if ncomp > 1:
            for icomp in range(2, ncomp + 1):
                name = "dispsf" + str(icomp)
                if model.verbose:
                    print('   loading {}...'.format(name))
                u2d = Util2d.load(f, model, (np.abs(nsfinit),), np.float32,
                                  name, ext_unit_dict,
                                  array_format=model.array_format)
                kwargs[name] = u2d

        # Item 5 NOBSSF
        if model.verbose:
            print('   loading NOBSSF...')
        line = f.readline()
        m_arr = line.strip().split()
        nobssf = int(m_arr[0])
        if model.verbose:
            print('   NOBSSF {}'.format(nobssf))

        # If NOBSSF > 0, store observation segment & reach (Item 6)
        obs_sf = []
        if nobssf > 0:
github modflowpy / flopy / flopy / modflow / mfdisu.py View on Github external
if model.verbose:
                print('   loading CL12...')
            cl12 = Util2d.load(f, model, (njag,), np.float32, 'cl12',
                               ext_unit_dict)
            if model.verbose:
                print('   CL12 {}'.format(cl12))

        # dataset 12 -- fahl
        fahl = None
        if idsymrd == 0:
            n = njag
        elif idsymrd == 1:
            n = njags
        if model.verbose:
            print('   loading FAHL...')
        fahl = Util2d.load(f, model, (n,), np.float32, 'fahl', ext_unit_dict)
        if model.verbose:
            print('   FAHL {}'.format(fahl))

        # dataset 7 -- stress period info
        if model.verbose:
            print('   loading stress period data...')
        perlen = []
        nstp = []
        tsmult = []
        steady = []
        for k in range(nper):
            line = f.readline()
            a1, a2, a3, a4 = line.strip().split()[0:4]
            a1 = float(a1)
            a2 = int(a2)
            a3 = float(a3)
github modflowpy / flopy / flopy / modflow / mfsubwt.py View on Github external
'dcom layer {}'.format(kk),
                                ext_unit_dict)
                dcom[k] = t
                # dz
                if model.verbose:
                    sys.stdout.write(
                        '  loading sub dataset 13 for layer {}\n'.format(kk))
                t = Util2d.load(f, model, (nrow, ncol), np.float32,
                                'dz layer {}'.format(kk),
                                ext_unit_dict)
                dz[k] = t
                # nz
                if model.verbose:
                    sys.stdout.write(
                        '  loading sub dataset 14 for layer {}\n'.format(kk))
                t = Util2d.load(f, model, (nrow, ncol), np.int,
                                'nz layer {}'.format(kk),
                                ext_unit_dict)
                nz[k] = t

        ids15 = None
        ids16 = None
        if isuboc > 0:
            # dataset 15
            if model.verbose:
                sys.stdout.write(
                    '  loading sub dataset 15 for layer {}\n'.format(kk))
            ids15 = np.empty(12, dtype=np.int)
            ids15 = read1d(f, ids15)
            iu = 1
            for k in range(1, 12, 2):
                model.add_pop_key_list(ids15[k])
github modflowpy / flopy / flopy / modflow / mfbcf.py View on Github external
for k in range(nlay):

            # allow for unstructured changing nodes per layer
            if nr is None:
                nrow = 1
                ncol = nc[k]
            else:
                nrow = nr
                ncol = nc

            # sf1
            if transient:
                if model.verbose:
                    print('   loading sf1 layer {0:3d}...'.format(k + 1))
                t = Util2d.load(f, model, (nrow, ncol), np.float32, 'sf1',
                                ext_unit_dict)
                sf1[k] = t

            # tran or hy
            if ((laycon[k] == 0) or (laycon[k] == 2)):
                if model.verbose:
                    print('   loading tran layer {0:3d}...'.format(k + 1))
                t = Util2d.load(f, model, (nrow, ncol), np.float32, 'tran',
                                ext_unit_dict)
                tran[k] = t
            else:
                if model.verbose:
                    print('   loading hy layer {0:3d}...'.format(k + 1))
                t = Util2d.load(f, model, (nrow, ncol), np.float32, 'hy',
                                ext_unit_dict)
                hy[k] = t
github modflowpy / flopy / flopy / modflow / mfswt.py View on Github external
iestfm, ipcsfl, ipcsfm, istfl, istfm = int(t[0]), int(t[1]), \
                                               int(t[2]), int(t[3]), \
                                               int(t[4]), int(t[5]), \
                                               int(t[6]), int(t[7]), \
                                               int(t[8]), int(t[9])

        # read dataset 4
        if model.verbose:
            sys.stdout.write('  loading swt dataset 4')
        gl0 = Util2d.load(f, model, (nrow, ncol), np.float32, 'gl0',
                          ext_unit_dict)

        # read dataset 5
        if model.verbose:
            sys.stdout.write('  loading swt dataset 5')
        sgm = Util2d.load(f, model, (nrow, ncol), np.float32, 'sgm',
                          ext_unit_dict)

        # read dataset 6
        if model.verbose:
            sys.stdout.write('  loading swt dataset 6')
        sgs = Util2d.load(f, model, (nrow, ncol), np.float32, 'sgs',
                          ext_unit_dict)

        # read datasets 7 to 13
        thick = [0] * nsystm
        void = [0] * nsystm
        sub = [0] * nsystm
        if icrcc == 0:
            sse = None
            ssv = None
            cr = [0] * nsystm
github modflowpy / flopy / flopy / mt3d / mtdsp.py View on Github external
for k in keywords:
                if k.lower() == 'multidiffusion':
                    multiDiff = True
        else:
            # go back to beginning of file
            f.seek(0, 0)

        # Read arrays
        if model.verbose:
            print('   loading AL...')
        al = Util3d.load(f, model, (nlay, nrow, ncol), np.float32, 'al',
                         ext_unit_dict, array_format="mt3d")

        if model.verbose:
            print('   loading TRPT...')
        trpt = Util2d.load(f, model, (nlay,), np.float32, 'trpt',
                           ext_unit_dict, array_format="mt3d",
                           array_free_format=False)

        if model.verbose:
            print('   loading TRPV...')
        trpv = Util2d.load(f, model, (nlay,), np.float32, 'trpv',
                           ext_unit_dict, array_format="mt3d",
                           array_free_format=False)

        if model.verbose:
            print('   loading DMCOEFF...')
        kwargs = {}
        dmcoef = []
        if multiDiff:
            dmcoef = Util3d.load(f, model, (nlay, nrow, ncol), np.float32,
                                 'dmcoef1', ext_unit_dict, array_format="mt3d")
github modflowpy / flopy / flopy / modflow / mflpf.py View on Github external
t = Util2d.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

            # vka
            if model.verbose:
                print('   loading vka layer {0:3d}...'.format(k + 1))
            key = 'vk'
            if layvka[k] != 0:
                key = 'vani'
            if 'vk' not in par_types and 'vani' not in par_types:
                t = Util2d.load(f, model, (nrow, ncol), np.float32, key,
                                ext_unit_dict)
            else:
                line = f.readline()
                key = 'vk'
                if 'vani' in par_types:
                    key = 'vani'
                t = mfpar.parameter_fill(model, (nrow, ncol), key, parm_dict,
                                         findlayer=k)
            vka[k] = t

            # storage properties
            if transient:

                # ss
                if model.verbose:
                    print('   loading ss layer {0:3d}...'.format(k + 1))
github modflowpy / flopy / flopy / modflow / mfbcf.py View on Github external
ext_unit_dict)
                hy[k] = t

            # vcont
            if k < (nlay - 1):
                if model.verbose:
                    print('   loading vcont layer {0:3d}...'.format(k + 1))
                t = Util2d.load(f, model, (nrow, ncol), np.float32, 'vcont',
                                ext_unit_dict)
                vcont[k] = t

            # sf2
            if (transient and ((laycon[k] == 2) or (laycon[k] == 3))):
                if model.verbose:
                    print('   loading sf2 layer {0:3d}...'.format(k + 1))
                t = Util2d.load(f, model, (nrow, ncol), np.float32, 'sf2',
                                ext_unit_dict)
                sf2[k] = t

            # wetdry
            if ((iwdflg != 0) and ((laycon[k] == 1) or (laycon[k] == 3))):
                if model.verbose:
                    print('   loading sf2 layer {0:3d}...'.format(k + 1))
                t = Util2d.load(f, model, (nrow, ncol), np.float32, 'wetdry',
                                ext_unit_dict)
                wetdry[k] = t

        if openfile:
            f.close()

        # set package unit number
        unitnumber = None
github modflowpy / flopy / flopy / modflow / mfbcf.py View on Github external
print('   loading tran layer {0:3d}...'.format(k + 1))
                t = Util2d.load(f, model, (nrow, ncol), np.float32, 'tran',
                                ext_unit_dict)
                tran[k] = t
            else:
                if model.verbose:
                    print('   loading hy layer {0:3d}...'.format(k + 1))
                t = Util2d.load(f, model, (nrow, ncol), np.float32, 'hy',
                                ext_unit_dict)
                hy[k] = t

            # vcont
            if k < (nlay - 1):
                if model.verbose:
                    print('   loading vcont layer {0:3d}...'.format(k + 1))
                t = Util2d.load(f, model, (nrow, ncol), np.float32, 'vcont',
                                ext_unit_dict)
                vcont[k] = t

            # sf2
            if (transient and ((laycon[k] == 2) or (laycon[k] == 3))):
                if model.verbose:
                    print('   loading sf2 layer {0:3d}...'.format(k + 1))
                t = Util2d.load(f, model, (nrow, ncol), np.float32, 'sf2',
                                ext_unit_dict)
                sf2[k] = t

            # wetdry
            if ((iwdflg != 0) and ((laycon[k] == 1) or (laycon[k] == 3))):
                if model.verbose:
                    print('   loading sf2 layer {0:3d}...'.format(k + 1))
                t = Util2d.load(f, model, (nrow, ncol), np.float32, 'wetdry',
github modflowpy / flopy / flopy / modflow / mfswt.py View on Github external
t = Util2d.load(f, model, (nrow, ncol), np.float32,
                                'sse layer {}'.format(kk), ext_unit_dict)
                ssv[k] = t
            else:
                # cr
                if model.verbose:
                    sys.stdout.write(
                        '  loading swt dataset 10 for layer {}\n'.format(kk))
                t = Util2d.load(f, model, (nrow, ncol), np.float32,
                                'cr layer {}'.format(kk), ext_unit_dict)
                cr[k] = t
                # cc
                if model.verbose:
                    sys.stdout.write(
                        '  loading swt dataset 11 for layer {}\n'.format(kk))
                t = Util2d.load(f, model, (nrow, ncol), np.float32,
                                'cc layer {}'.format(kk), ext_unit_dict)
                cc[k] = t
            # void
            if model.verbose:
                sys.stdout.write(
                    '  loading swt dataset 12 for layer {}\n'.format(kk))
            t = Util2d.load(f, model, (nrow, ncol), np.float32,
                            'void layer {}'.format(kk), ext_unit_dict)
            void[k] = t
            # sub
            if model.verbose:
                sys.stdout.write(
                    '  loading swt dataset 13 for layer {}\n'.format(kk))
            t = Util2d.load(f, model, (nrow, ncol), np.float32,
                            'sub layer {}'.format(kk), ext_unit_dict)
            sub[k] = t