

def __init__(self, model, ihedfm=0, iddnfm=0, item2=[[0, 1, 0, 1]], item3=[[0, 0, 1, 0]], extension=['oc', 'hds', 'ddn', 'cbc'], unitnumber=[14, 51, 52, 53], save_head_every=None, words=None, compact=False, chedfm=None, cddnfm=None):
    hds_fmt = 'DATA(BINARY)'
    ddn_fmt = 'DATA(BINARY)'
    if (chedfm is not None):
        hds_fmt = 'DATA'
    if (cddnfm is not None):
        ddn_fmt = 'DATA'
    Package.__init__(self, model, extension, ['OC', hds_fmt, ddn_fmt, 'DATA(BINARY)'], unitnumber, extra=['', 'REPLACE', 'REPLACE', 'REPLACE'])
    self.heading = ('# Output control package file' + ' for MODFLOW, generated by Flopy.')
    if (words is not None):
        self.heading += ' Output control by words option'
    self.heading += '\n# Deprecated flopy OC class'
    print('Warning: ModflowOc88 flopy class is deprecated')
    print('         Please use ModflowOc class')
    self.url = 'oc.htm'
    self.ihedfm = ihedfm
    self.iddnfm = iddnfm
    self.chedfm = chedfm
    self.cddnfm = cddnfm
    if (words is not None):
        (hflag, dflag) = (False, False)
        if (('head' in words) and (ihedfm != 0)):
            hflag = True
        if (('drawdown' in words) and (iddnfm != 0)):
            dflag = True
        self.words = []
        self.compact = compact
        try:
            for w in words:
                self.words.append(w.upper())
            word_list = []
            if (save_head_every is None):
                raise TypeError('to use the 1d words OC option, save_head_every must be used')
            nstp = self.parent.get_package('DIS').nstp
            for p in range(len(nstp)):
                for s in range(nstp[p]):
                    if ((s % save_head_every) == 0):
                        word_list.append('PERIOD {0:5.0f} STEP {1:5.0f}\n'.format((p + 1), (s + 1)))
                        for w in words:
                            if ('PBUDGET' in w.upper()):
                                word_list.append('  PRINT BUDGET\n')
                            elif ('PHEAD' in w.upper()):
                                word_list.append('  PRINT HEAD\n')
                            else:
                                word_list.append((('  SAVE ' + w.upper()) + '\n'))
                        if hflag:
                            word_list.append('  PRINT HEAD\n')
                        if dflag:
                            word_list.append('  PRINT DRAWDOWN\n')
                        word_list.append('\n')
            self.word_list = word_list
        except:
            word_list = []
            self.words = []
            for i in words:
                (p, s) = (int(i[0]), int(i[1]))
                wwords = i[2:]
                word_list.append('PERIOD {0:5.0f} STEP {1:45.0f}\n'.format(p, s))
                for w in wwords:
                    if ('PBUDGET' in w.upper()):
                        word_list.append('  PRINT BUDGET\n')
                    elif ('PHEAD' in w.upper()):
                        word_list.append('  PRINT HEAD\n')
                    else:
                        word_list.append((('  SAVE ' + w.upper()) + '\n'))
                    if (w.upper() not in self.words):
                        self.words.append(w.upper())
                if hflag:
                    word_list.append('  PRINT HEAD\n')
                if dflag:
                    word_list.append('  PRINT DRAWDOWN\n')
                word_list.append('\n')
            self.word_list = word_list
    else:
        self.words = None
        if (item2 != None):
            error_message = 'item2 must have 4 columns'
            if (not isinstance(item2, list)):
                item2 = [item2]
            for a in item2:
                assert (len(a) == 4), error_message
            self.item2 = item2
        if (item3 != None):
            error_message = 'item3 must have 4 columns'
            if (not isinstance(item3, list)):
                item3 = [item3]
            for a in item3:
                assert (len(a) == 4), error_message
            self.item3 = item3
        if (save_head_every is not None):
            nstp = self.parent.get_package('DIS').nstp
            self.item3 = []
            for p in range(len(nstp)):
                for s in range(1, (nstp[p] + 1)):
                    if ((s % save_head_every) == 0):
                        self.item3.append([0, 0, 1, 0])
                    else:
                        self.item3.append([0, 0, 0, 0])
    self.parent.add_package(self)

dataset/ETHPy150Open modflowpy/flopy/flopy/modflow/mfoc88.py ModflowOc88.__init__/original