@staticmethod
    def load(f, model, ext_unit_dict=None):
        """
        Load an existing package.

        Parameters
        ----------
        f : filename or file handle
            File to load.
        model : model object
            The model object (of type :class:`flopy.modflow.mf.Modflow`) to
            which this package will be added.
        ext_unit_dict : dictionary, optional
            If the arrays in the file are specified using EXTERNAL,
            or older style array control records, then `f` should be a file
            handle.  In this case ext_unit_dict is required, which can be
            constructed using the function
            :class:`flopy.utils.mfreadnam.parsenamefile`.

        Returns
        -------
        lmt : ModflowLmt object
            ModflowLmt object.

        Examples
        --------

        >>> import flopy
        >>> m = flopy.modflow.Modflow()
        >>> lmt = flopy.modflow.ModflowGhb.load('test.lmt', m)

        """

        if model.verbose:
            sys.stdout.write('loading lmt package file...\n')

        # set default values
        prefix = os.path.basename(f)
        prefix = prefix[:prefix.rfind('.')]
        output_file_name = prefix + '.ftl'
        output_file_unit = 333
        output_file_header = 'standard'
        output_file_format = 'unformatted'

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

        for line in f:
            if line[0] == '#':
                continue
            t = line.strip().split()
            if len(t) < 2:
                continue
            if t[0].lower() == 'output_file_name':
                output_file_name = t[1]
            elif t[0].lower() == 'output_file_unit':
                output_file_unit = int(t[1])
            elif t[0].lower() == 'output_file_header':
                output_file_header = t[1]
            elif t[0].lower() == 'output_file_format':
                output_file_format = t[1]

        lmt = ModflowLmt(model, output_file_name, output_file_unit,
                         output_file_header, output_file_format)
        return lmt
dataset/ETHPy150Open modflowpy/flopy/flopy/modflow/mflmt.py/ModflowLmt.load/original