

def write_file(self):
    '\n        Write the package file.\n\n        Returns\n        -------\n        None\n\n        '
    f_oc = open(self.fn_path, 'w')
    f_oc.write(('%s\n' % self.heading))
    nstp = self.parent.get_package('DIS').nstp
    if (self.words is not None):
        f_oc.write('HEAD PRINT FORMAT {0:3.0f}\n'.format(self.ihedfm))
        if (self.chedfm is not None):
            f_oc.write('HEAD SAVE FORMAT {0:20s} LABEL\n'.format(self.chedfm))
        f_oc.write('HEAD SAVE UNIT {0:5.0f}\n'.format(self.unit_number[1]))
        f_oc.write('DRAWDOWN PRINT FORMAT {0:3.0f}\n'.format(self.iddnfm))
        if (self.cddnfm is not None):
            f_oc.write('DRAWDOWN SAVE FORMAT {0:20s} LABEL\n'.format(self.cddnfm))
        f_oc.write('DRAWDOWN SAVE UNIT {0:5.0f}\n'.format(self.unit_number[2]))
        if self.compact:
            f_oc.write('COMPACT BUDGET FILES')
        f_oc.write('\n')
        for i in self.word_list:
            f_oc.write(i)
    else:
        f_oc.write(('%3i%3i%5i%5i\n' % (self.ihedfm, self.iddnfm, self.unit_number[1], self.unit_number[2])))
        ss = 0
        for p in range(len(nstp)):
            for s in range(nstp[p]):
                if (ss < len(self.item2)):
                    a = self.item2[ss]
                else:
                    a = self.item2[(- 1)]
                if (ss < len(self.item3)):
                    b = self.item3[ss]
                else:
                    b = self.item3[(- 1)]
                f_oc.write(('%3i%3i%3i%3i  Period %3i, step %3i\n' % (a[0], a[1], a[2], a[3], (p + 1), (s + 1))))
                if (a[0] > 0):
                    (nr, nc) = b.shape
                    assert (nr == nlay), ('item3 must have {0:1d} rows when incode > 0 ' % nlay)
                    for bb in b:
                        f_oc.write(('%3i%3i%3i%3i\n' % (bb[0], bb[1], bb[2], bb[3])))
                else:
                    f_oc.write(('%3i%3i%3i%3i\n' % (b[0], b[1], f_oc[2], b[3])))
                ss = (ss + 1)
    f_oc.close()

dataset/ETHPy150Open modflowpy/flopy/flopy/modflow/mfoc88.py ModflowOc88.write_file/VarMisuse@506/841 `b`->`f_oc`