def write_file(self):
        """
        Write the package file.

        Returns
        -------
        None

        """
        # -open file for writing
        f = open(self.fn_path, 'w')

        # -write header
        f.write('{}\n'.format(self.heading))

        # -Section 1 - MNWMAX, ipakcb, MNWPRNT {OPTION}
        auxParamString = ''
        if self.aux != None:
            for param in self.aux:
                auxParamString = auxParamString + 'AUX %s ' % param
        f.write('{:10d}{:10d}{:10d} {}\n'.format(self.mnwmax,
                                                 self.ipakcb,
                                                 self.mnwprnt,
                                                 auxParamString))

        # -Section 2 - Repeat this section MNWMAX times (once for each well)
        for i in range(self.mnwmax):
            # -Section 2a - WELLID, NNODES
            f.write('{}{:10d}\n'.format(self.wellid[i], self.nnodes[i]))
            # -Section 2b - LOSSTYPE, PUMPLOC, Qlimit, PPFLAG, PUMPCAP
            f.write('{} {:10d}{:10d}{:10d}{:10d}\n'.format(self.losstype[i],
                                                           self.pumploc[i],
                                                           self.qlimit[i],
                                                           self.ppflag[i],
                                                           self.pumpcap[i]))
            # -Section 2c - {Rw, Rskin, Kskin, B, C, P, CWC}
            if self.losstype[i] == 'THIEM':
                f.write('{:10.4g}\n'.format(self.rw[i]))
            elif self.losstype[i] == 'SKIN':
                f.write('{:10.4g}{:10.4g}{:10.4g}\n'.format(self.rw[i],
                                                            self.rskin[i],
                                                            self.kskin[i]))
            elif self.losstype[i] == 'GENERAL':
                f.write('{:10.4g}{:10.4g}{:10.4g}{:10.4g}\n'.format(self.rw[i],
                                                                    self.b[i],
                                                                    self.c[i],
                                                                    self.p[i]))
            elif self.losstype[i] == 'SPECIFYcwc':
                f.write('{:10.4g}\n'.format(self.cwc[i]))

            # -Section 2d - Repeat sections 2d-1 or 2d-2 once for each open interval
            # -Section 2d-1 - NNODES > 0; LAY, ROW, COL {Rw, Rskin, Kskin, B, C, P, CWC, PP}
            absNnodes = abs(self.nnodes[i])
            if self.nnodes[i] > 0:
                for n in range(absNnodes):
                    f.write('{:10d}{:10d}{:10d}\n'.format(
                        self.lay_row_col[i][n, 0] + 1,
                        self.lay_row_col[i][n, 1] + 1,
                        self.lay_row_col[i][n, 2] + 1))
            # -Section 2d-2 - NNODES < 0; Ztop, Zbotm, ROW, COL {Rw, Rskin, Kskin, B, C, P, CWC, PP}
            elif self.nnodes[i] < 0:
                for n in range(absNnodes):
                    # print i, n
                    # print self.ztop_zbotm_row_col
                    f.write('{:10.4g} {:10.4g} {:10d} {:10d}\n'.format(
                            self.ztop_zbotm_row_col[i][n, 0],
                            self.ztop_zbotm_row_col[i][n, 1],
                            int(self.ztop_zbotm_row_col[i][n, 2]) + 1,
                            int(self.ztop_zbotm_row_col[i][n, 3]) + 1))

        # -Section 3 - Repeat this section NPER times (once for each stress period)
        for p in range(self.nper):
            f.write('{:10d}\n'.format(self.itmp[p]))

            # -Section 4 - Repeat this section ITMP times (once for each well to be simulated in current stress period)
            if self.itmp[p] > 0:
                '''
                Create an array that will hold well names to be simulated during this stress period and find their corresponding
                index number in the "wellid" array so the right parameters (Hlim Qcut {Qfrcmn Qfrcmx}) are accessed.
                '''
                itmp_wellid_index_array = np.empty((self.itmp[p], 2),
                                                   dtype='object')
                for well in range(self.itmp[p]):
                    itmp_wellid_index_array[well, 0] = self.wellid_qdes[p][
                        well, 0]
                    itmp_wellid_index_array[well, 1] = np.where(
                        self.wellid == self.wellid_qdes[p][well, 0])

                for j in range(self.itmp[p]):
                    # -Section 4a - WELLID Qdes {CapMult} {Cprime} {xyz}
                    assert self.wellid_qdes[p][j, 0] in self.wellid, \
                        'WELLID for pumping well is not present in "wellid" array'

                    # print self.wellid_qdes[p][j, 0], self.wellid_qdes[p][j, 1]

                    f.write('{} {:10.4g}\n'.format(self.wellid_qdes[p][j, 0],
                                                   float(self.wellid_qdes[p][
                                                             j, 1])))

        f.close()
dataset/ETHPy150Open modflowpy/flopy/flopy/modflow/mfmnw2.py/ModflowMnw2.write_file/original