#NEWLINE# def set_pval( self , model , ext_unit_dict ) : #NEWLINE# #INDENT# '\n        Load an existing pval package and set pval data for a model.\n\n        Parameters\n        ----------\n        model : model object\n            The model object (of type :class:`flopy.modflow.mf.Modflow`) to\n            which this package will be added.\n        ext_unit_dict : dictionary, optional\n            If the arrays in the file are specified using EXTERNAL,\n            or older style array control records, then `f` should be a file\n            handle.  In this case ext_unit_dict is required, which can be\n            constructed using the function\n            :class:`flopy.utils.mfreadnam.parsenamefile`.\n\n        Returns\n        -------\n\n\n        Examples\n        --------\n\n        >>> ml.mfpar.set_pval(ml, ext_unit_dict)\n\n        ' #NEWLINE# pval = None #NEWLINE# pval_key = None #NEWLINE# for ( key , item ) in ext_unit_dict . items ( ) : #NEWLINE# #INDENT# if ( item . filetype . lower ( ) == 'pval' ) : #NEWLINE# #INDENT# pval = item #NEWLINE# pval_key = key #NEWLINE# #UNINDENT# #UNINDENT# if ( pval_key is not None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . pval = ModflowPval . load ( pval . filename , model , ext_unit_dict = ext_unit_dict ) #NEWLINE# if model . verbose : #NEWLINE# #INDENT# sys . stdout . write ( '   {} package load...success\n' . format ( item . pval . name [ 0 ] ) ) #NEWLINE# #UNINDENT# ext_unit_dict . pop ( pval_key ) #NEWLINE# model . remove_package ( 'PVAL' ) #NEWLINE# #UNINDENT# except BaseException as o : #NEWLINE# #INDENT# sys . stdout . write ( '   {} package load...failed\n      {!s}' . format ( 'PVAL' , o ) ) #NEWLINE# #UNINDENT# #UNINDENT# return