#NEWLINE# @ staticmethod #NEWLINE# def load( f , model , nlay = None , nrow = None , ncol = None , ext_unit_dict = None , check = True ) : #NEWLINE# #INDENT# "\n        Load an existing package.\n\n        Parameters\n        ----------\n        f : filename or file handle\n            File to load.\n        model : model object\n            The model object (of type :class:`flopy.modflow.mf.Modflow`) to\n            which this package will be added.\n        nlay, nrow, ncol : int, optional\n            If not provided, then the model must contain a discretization\n            package with correct values for these parameters.\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        check : boolean\n            Check package data for common errors. (default True)\n        Returns\n        -------\n        bas : ModflowBas object\n            ModflowBas object (of type :class:`flopy.modflow.ModflowBas`)\n\n        Examples\n        --------\n\n        >>> import flopy\n        >>> m = flopy.modflow.Modflow()\n        >>> bas = flopy.modflow.ModflowBas.load('test.bas', m, nlay=1, nrow=10,\n        >>>                                      ncol=10)\n\n        " #NEWLINE# if model . verbose : #NEWLINE# #INDENT# sys . stdout . write ( 'loading bas6 package file...\n' ) #NEWLINE# #UNINDENT# if ( not hasattr ( f , 'read' ) ) : #NEWLINE# #INDENT# filename = f #NEWLINE# f = open ( filename , 'r' ) #NEWLINE# #UNINDENT# while True : #NEWLINE# #INDENT# line = f . readline ( ) #NEWLINE# if ( line [ 0 ] != '#' ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# line = line . upper ( ) #NEWLINE# opts = line . strip ( ) . split ( ) #NEWLINE# ixsec = False #NEWLINE# ichflg = False #NEWLINE# ifrefm = False #NEWLINE# iprinttime = False #NEWLINE# ishowp = False #NEWLINE# istoperror = False #NEWLINE# stoper = None #NEWLINE# if ( 'XSECTION' in opts ) : #NEWLINE# #INDENT# ixsec = True #NEWLINE# #UNINDENT# if ( 'CHTOCH' in opts ) : #NEWLINE# #INDENT# ichflg = True #NEWLINE# #UNINDENT# if ( 'FREE' in opts ) : #NEWLINE# #INDENT# ifrefm = True #NEWLINE# #UNINDENT# if ( 'PRINTTIME' in opts ) : #NEWLINE# #INDENT# iprinttime = True #NEWLINE# #UNINDENT# if ( 'SHOWPROGRESS' in opts ) : #NEWLINE# #INDENT# ishowp = True #NEWLINE# #UNINDENT# if ( 'STOPERROR' in opts ) : #NEWLINE# #INDENT# istoperror = True #NEWLINE# i = opts . index ( 'STOPERROR' ) #NEWLINE# stoper = np . float32 ( opts [ ( i + 1 ) ] ) #NEWLINE# #UNINDENT# if ( ( nlay is None ) and ( nrow is None ) and ( ncol is None ) ) : #NEWLINE# #INDENT# ( nrow , ncol , nlay , nper ) = model . get_nrow_ncol_nlay_nper ( ) #NEWLINE# #UNINDENT# ibound = Util3d . load ( f , model , ( nlay , nrow , ncol ) , np . int , 'ibound' , ext_unit_dict ) #NEWLINE# line = f . readline ( ) #NEWLINE# hnoflo = np . float32 ( line . strip ( ) . split ( ) [ 0 ] ) #NEWLINE# strt = Util3d . load ( f , model , ( nlay , nrow , ncol ) , np . float32 , 'strt' , ext_unit_dict ) #NEWLINE# f . close ( ) #NEWLINE# bas = ModflowBas ( model , ibound = ibound , strt = strt , ixsec = ixsec , ifrefm = ifrefm , ichflg = ichflg , stoper = stoper , hnoflo = hnoflo ) #NEWLINE# if check : #NEWLINE# #INDENT# bas . check ( f = '{}.chk' . format ( bas . name [ 0 ] ) , verbose = bas . parent . verbose , level = 0 ) #NEWLINE# #UNINDENT# return bas