<s> import numpy as np <EOL> from . . pakbase import Package <EOL> class ModflowMnw2 ( Package ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , model , mnwmax = <NUM_LIT:0> , ipakcb = <NUM_LIT:0> , mnwprnt = <NUM_LIT:0> , aux = None , <EOL> wellid = None , nnodes = None , losstype = None , pumploc = <NUM_LIT:0> , qlimit = <NUM_LIT:0> , <EOL> ppflag = <NUM_LIT:0> , pumpcap = <NUM_LIT:0> , <EOL> lay_row_col = None , ztop_zbotm_row_col = None , rw = <NUM_LIT:0> , rskin = <NUM_LIT:0> , <EOL> kskin = <NUM_LIT:0> , b = <NUM_LIT:0> , c = <NUM_LIT:0> , p = <NUM_LIT:0> , cwc = <NUM_LIT:0> , pp = <NUM_LIT:1> , <EOL> itmp = <NUM_LIT:0> , wellid_qdes = None , <EOL> extension = '<STR_LIT>' , unitnumber = <NUM_LIT> ) : <EOL> """<STR_LIT>""" <EOL> Package . __init__ ( self , model , extension , '<STR_LIT>' , <EOL> unitnumber ) <EOL> self . url = '<STR_LIT>' <EOL> self . nper = self . parent . nrow_ncol_nlay_nper [ - <NUM_LIT:1> ] <EOL> self . heading = '<STR_LIT>' <EOL> self . mnwmax = int ( <EOL> mnwmax ) <EOL> if ipakcb != <NUM_LIT:0> : <EOL> if ipakcb < <NUM_LIT:0> : <EOL> self . ipakcb = - <NUM_LIT> <EOL> else : <EOL> self . ipakcb = <NUM_LIT> <EOL> else : <EOL> self . ipakcb = <NUM_LIT:0> <EOL> self . mnwprnt = int ( mnwprnt ) <EOL> self . aux = aux <EOL> self . wellid = wellid <EOL> self . lay_row_col = lay_row_col <EOL> self . ztop_zbotm_row_col = ztop_zbotm_row_col <EOL> self . wellid_qdes = wellid_qdes <EOL> '''<STR_LIT>''' <EOL> self . wellid = np . empty ( ( self . mnwmax ) , dtype = '<STR_LIT>' ) <EOL> self . nnodes = np . zeros ( ( self . mnwmax ) , dtype = np . int32 ) <EOL> self . losstype = np . empty ( ( self . mnwmax ) , dtype = '<STR_LIT>' ) <EOL> self . pumploc = np . zeros ( ( self . mnwmax ) , dtype = '<STR_LIT>' ) <EOL> self . qlimit = np . zeros ( ( self . mnwmax ) , dtype = '<STR_LIT>' ) <EOL> self . ppflag = np . zeros ( ( self . mnwmax ) , dtype = '<STR_LIT>' ) <EOL> self . pumpcap = np . zeros ( ( self . mnwmax ) , dtype = '<STR_LIT>' ) <EOL> self . rw = np . zeros ( self . mnwmax , dtype = '<STR_LIT>' ) <EOL> self . rskin = np . zeros ( self . mnwmax , dtype = '<STR_LIT>' ) <EOL> self . kskin = np . zeros ( self . mnwmax , dtype = '<STR_LIT>' ) <EOL> self . b = np . zeros ( self . mnwmax , dtype = '<STR_LIT>' ) <EOL> self . c = np . zeros ( self . mnwmax , dtype = '<STR_LIT>' ) <EOL> self . p = np . zeros ( self . mnwmax , dtype = '<STR_LIT>' ) <EOL> self . cwc = np . zeros ( self . mnwmax , dtype = '<STR_LIT>' ) <EOL> self . pp = np . zeros ( self . mnwmax , dtype = '<STR_LIT>' ) <EOL> self . itmp = np . zeros ( self . nper , dtype = '<STR_LIT>' ) <EOL> self . wellid [ : ] = np . array ( wellid , dtype = '<STR_LIT>' ) <EOL> self . nnodes [ : ] = np . array ( nnodes , dtype = np . int ) <EOL> self . losstype [ : ] = np . array ( losstype , dtype = '<STR_LIT>' ) <EOL> self . pumploc [ : ] = np . array ( pumploc , dtype = np . int32 ) <EOL> self . qlimit [ : ] = np . array ( qlimit , dtype = np . int32 ) <EOL> self . ppflag [ : ] = np . array ( ppflag , dtype = np . int32 ) <EOL> self . pumpcap [ : ] = np . array ( pumpcap , dtype = np . int32 ) <EOL> self . rw [ : ] = np . array ( rw , dtype = np . float32 ) <EOL> self . rskin [ : ] = np . array ( rskin , dtype = np . float32 ) <EOL> self . kskin [ : ] = np . array ( kskin , dtype = np . float32 ) <EOL> self . b [ : ] = np . array ( b , dtype = np . float32 ) <EOL> self . c [ : ] = np . array ( c , dtype = np . float32 ) <EOL> self . p [ : ] = np . array ( p , dtype = np . float32 ) <EOL> self . cwc [ : ] = np . array ( cwc , dtype = np . float32 ) <EOL> self . pp [ : ] = np . array ( pp , dtype = np . float32 ) <EOL> self . itmp [ : ] = np . array ( itmp , dtype = np . int32 ) <EOL> lossTypes = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> for i in range ( mnwmax ) : <EOL> assert len ( self . wellid [ i ] . split ( <EOL> '<STR_LIT:U+0020>' ) ) == <NUM_LIT:1> , '<STR_LIT>' % self . wellid [ i ] <EOL> assert self . losstype [ <EOL> i ] in lossTypes , '<STR_LIT>' % self . losstype [ i ] <EOL> assert self . itmp [ <EOL> <NUM_LIT:0> ] >= <NUM_LIT:0> , '<STR_LIT>' <EOL> assert self . itmp . max ( ) <= self . mnwmax , '<STR_LIT>' <EOL> self . parent . add_package ( self ) <EOL> def write_file ( self ) : <EOL> """<STR_LIT>""" <EOL> f = open ( self . fn_path , '<STR_LIT:w>' ) <EOL> f . write ( '<STR_LIT>' . format ( self . heading ) ) <EOL> auxParamString = '<STR_LIT>' <EOL> if self . aux != None : <EOL> for param in self . aux : <EOL> auxParamString = auxParamString + '<STR_LIT>' % param <EOL> f . write ( '<STR_LIT>' . format ( self . mnwmax , <EOL> self . ipakcb , <EOL> self . mnwprnt , <EOL> auxParamString ) ) <EOL> for i in range ( self . mnwmax ) : <EOL> f . write ( '<STR_LIT>' . format ( self . wellid [ i ] , self . nnodes [ i ] ) ) <EOL> f . write ( '<STR_LIT>' . format ( self . losstype [ i ] , <EOL> self . pumploc [ i ] , <EOL> self . qlimit [ i ] , <EOL> self . ppflag [ i ] , <EOL> self . pumpcap [ i ] ) ) <EOL> if self . losstype [ i ] == '<STR_LIT>' : <EOL> f . write ( '<STR_LIT>' . format ( self . rw [ i ] ) ) <EOL> elif self . losstype [ i ] == '<STR_LIT>' : <EOL> f . write ( '<STR_LIT>' . format ( self . rw [ i ] , <EOL> self . rskin [ i ] , <EOL> self . kskin [ i ] ) ) <EOL> elif self . losstype [ i ] == '<STR_LIT>' : <EOL> f . write ( '<STR_LIT>' . format ( self . rw [ i ] , <EOL> self . b [ i ] , <EOL> self . c [ i ] , <EOL> self . p [ i ] ) ) <EOL> elif self . losstype [ i ] == '<STR_LIT>' : <EOL> f . write ( '<STR_LIT>' . format ( self . cwc [ i ] ) ) <EOL> absNnodes = abs ( self . nnodes [ i ] ) <EOL> if self . nnodes [ i ] > <NUM_LIT:0> : <EOL> for n in range ( absNnodes ) : <EOL> f . write ( '<STR_LIT>' . format ( <EOL> self . lay_row_col [ i ] [ n , <NUM_LIT:0> ] + <NUM_LIT:1> , <EOL> self . lay_row_col [ i ] [ n , <NUM_LIT:1> ] + <NUM_LIT:1> , <EOL> self . lay_row_col [ i ] [ n , <NUM_LIT:2> ] + <NUM_LIT:1> ) ) <EOL> elif self . nnodes [ i ] < <NUM_LIT:0> : <EOL> for n in range ( absNnodes ) : <EOL> f . write ( '<STR_LIT>' . format ( <EOL> self . ztop_zbotm_row_col [ i ] [ n , <NUM_LIT:0> ] , <EOL> self . ztop_zbotm_row_col [ i ] [ n , <NUM_LIT:1> ] , <EOL> int ( self . ztop_zbotm_row_col [ i ] [ n , <NUM_LIT:2> ] ) + <NUM_LIT:1> , <EOL> int ( self . ztop_zbotm_row_col [ i ] [ n , <NUM_LIT:3> ] ) + <NUM_LIT:1> ) ) <EOL> for p in range ( self . nper ) : <EOL> f . write ( '<STR_LIT>' . format ( self . itmp [ p ] ) ) <EOL> if self . itmp [ p ] > <NUM_LIT:0> : <EOL> '''<STR_LIT>''' <EOL> itmp_wellid_index_array = np . empty ( ( self . itmp [ p ] , <NUM_LIT:2> ) , <EOL> dtype = '<STR_LIT:object>' ) <EOL> for well in range ( self . itmp [ p ] ) : <EOL> itmp_wellid_index_array [ well , <NUM_LIT:0> ] = self . wellid_qdes [ p ] [ <EOL> well , <NUM_LIT:0> ] <EOL> itmp_wellid_index_array [ well , <NUM_LIT:1> ] = np . where ( <EOL> self . wellid == self . wellid_qdes [ p ] [ well , <NUM_LIT:0> ] ) <EOL> for j in range ( self . itmp [ p ] ) : <EOL> assert self . wellid_qdes [ p ] [ j , <NUM_LIT:0> ] in self . wellid , '<STR_LIT>' <EOL> f . write ( '<STR_LIT>' . format ( self . wellid_qdes [ p ] [ j , <NUM_LIT:0> ] , <EOL> float ( self . wellid_qdes [ p ] [ <EOL> j , <NUM_LIT:1> ] ) ) ) <EOL> f . close ( ) </s>
