@staticmethod
    def get_ocoutput_units(f, ext_unit_dict=None):


        #initialize
        ihedun = 0
        iddnun = 0
        fhead = None
        fddn = None

        numericformat = False

        #open file
        if not hasattr(f, 'read'):
            filename = f
            f = open(filename, 'r')

        # read header
        ipos = f.tell()
        while True:
            line = f.readline()
            if line[0] == '#':
                continue
            elif line[0] == []:
                continue
            else:
                lnlst = line.strip().split()
                try:
                    ihedfm, iddnfm = int(lnlst[0]), int(lnlst[1])
                    ihedun, iddnun = int(lnlst[2]), int(lnlst[3])
                    numericformat = True
                except:
                    f.seek(ipos)
                    pass
                # exit so the remaining data can be read
                #  from the file based on numericformat
                break
        # set pointer to current position in the OC file
        ipos = f.tell()
        #
        if not numericformat:
            while True:
                line = f.readline()
                if len(line) < 1:
                    break
                lnlst = line.strip().split()
                if line[0] == '#':
                    continue

                # skip blank line in the OC file
                if len(lnlst) < 1:
                    continue

                #dataset 1 values
                elif ('HEAD' in lnlst[0].upper() and
                      'SAVE' in lnlst[1].upper() and
                      'UNIT' in lnlst[2].upper()
                      ):
                    ihedun = int(lnlst[3])
                elif ('DRAWDOWN' in lnlst[0].upper() and
                      'SAVE' in lnlst[1].upper() and
                      'UNIT' in lnlst[2].upper()
                      ):
                    iddnun = int(lnlst[3])
                #dataset 2
                elif 'PERIOD' in lnlst[0].upper():
                    break
        #
        if ext_unit_dict is not None:
            try:
                fhead = ext_unit_dict[ihedun]
            except:
                pass
            try:
                fddn = ext_unit_dict[iddnun]
            except:
                pass

        # close the oc file
        f.close()

        # return
        return ihedun, fhead, iddnun, fddn
Checks if a database exists.
dataset/ETHPy150Open modflowpy/flopy/flopy/modflow/mfoc.py/ModflowOc.get_ocoutput_units--crossover with--dataset/ETHPy150Open python-provy/provy/provy/more/base/database/postgresql.py/BasePostgreSQLRole.database_exists