#NEWLINE# def __init__( self , model , nstrm = 2 , nss = 0 , nsfrpar = 0 , nparseg = 0 , const = 128390.4 , dleak = 0.0001 , istcb1 = 50 , istcb2 = 66 , isfropt = 0 , nstrail = 10 , isuzn = 1 , nsfrsets = 30 , irtflg = 1 , numtim = 2 , weight = 0.75 , flwtol = 0.0001 , reach_data = None , segment_data = None , channel_geometry_data = None , channel_flow_data = None , dataset_5 = None , reachinput = False , transroute = False , tabfiles = False , tabfiles_dict = None , extension = 'sfr' , unitnumber = 17 ) : #NEWLINE# #INDENT# '\n        Package constructor\n        ' #NEWLINE# Package . __init__ ( self , model , extension , 'SFR' , unitnumber ) #NEWLINE# self . url = 'sfr2.htm' #NEWLINE# self . nper = self . parent . nrow_ncol_nlay_nper [ ( - 1 ) ] #NEWLINE# self . nper = ( 1 if ( self . nper == 0 ) else self . nper ) #NEWLINE# self . heading = '# SFR2 for MODFLOW, generated by Flopy.' #NEWLINE# self . reachinput = reachinput #NEWLINE# self . transroute = transroute #NEWLINE# self . tabfiles = tabfiles #NEWLINE# self . tabfiles_dict = tabfiles_dict #NEWLINE# self . numtab = ( 0 if ( not tabfiles ) else len ( tabfiles_dict ) ) #NEWLINE# self . maxval = ( np . max ( [ tb [ 'numval' ] for tb in tabfiles_dict . values ( ) ] ) if ( self . numtab > 0 ) else 0 ) #NEWLINE# self . nstrm = ( ( np . sign ( nstrm ) * len ( reach_data ) ) if ( reach_data is not None ) else nstrm ) #NEWLINE# self . nss = ( len ( segment_data [ 0 ] ) if ( segment_data is not None ) else nss ) #NEWLINE# self . nsfrpar = nsfrpar #NEWLINE# self . nparseg = nparseg #NEWLINE# self . const = const #NEWLINE# self . dleak = dleak #NEWLINE# if ( istcb1 != 0 ) : #NEWLINE# #INDENT# if ( istcb1 < 0 ) : #NEWLINE# #INDENT# self . istcb1 = ( - 53 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . istcb1 = 53 #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . istcb1 = 0 #NEWLINE# #UNINDENT# self . istcb2 = istcb2 #NEWLINE# self . isfropt = isfropt #NEWLINE# self . nstrail = nstrail #NEWLINE# self . isuzn = isuzn #NEWLINE# self . nsfrsets = nsfrsets #NEWLINE# self . irtflag = irtflg #NEWLINE# self . numtim = numtim #NEWLINE# self . weight = weight #NEWLINE# self . flwtol = flwtol #NEWLINE# self . reach_data = self . get_empty_reach_data ( np . abs ( self . nstrm ) ) #NEWLINE# if ( reach_data is not None ) : #NEWLINE# #INDENT# for n in reach_data . dtype . names : #NEWLINE# #INDENT# self . reach_data [ n ] = reach_data [ n ] #NEWLINE# #UNINDENT# #UNINDENT# if ( ( np . diff ( self . reach_data . node ) . max ( ) == 0 ) and ( 'DIS' in self . parent . get_package_list ( ) ) ) : #NEWLINE# #INDENT# lrc = self . reach_data [ [ 'k' , 'i' , 'j' ] ] #NEWLINE# lrc = ( lrc . view ( ( int , len ( lrc . dtype . names ) ) ) + 1 ) . tolist ( ) #NEWLINE# self . reach_data [ 'node' ] = self . parent . dis . get_node ( lrc ) #NEWLINE# #UNINDENT# self . reach_data . sort ( order = [ 'iseg' , 'ireach' ] ) #NEWLINE# new_cols = { #NEWLINE# #INDENT# 'reachID' : np . arange ( 1 , ( len ( self . reach_data ) + 1 ) ) , #NEWLINE# 'outreach' : np . zeros ( len ( self . reach_data ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# for ( k , v ) in new_cols . items ( ) : #NEWLINE# #INDENT# if ( k not in self . reach_data . dtype . names ) : #NEWLINE# #INDENT# recfunctions . append_fields ( self . reach_data , names = k , data = v , asrecarray = True ) #NEWLINE# #UNINDENT# #UNINDENT# self . stress_period_data = MfList ( self , self . reach_data , dtype = self . reach_data . dtype ) #NEWLINE# self . segment_data = { #NEWLINE# #INDENT# 0 : self . get_empty_segment_data ( self . nss ) , #NEWLINE# #UNINDENT# } #NEWLINE# if ( segment_data is not None ) : #NEWLINE# #INDENT# for i in segment_data . keys ( ) : #NEWLINE# #INDENT# self . segment_data [ i ] = self . get_empty_segment_data ( self . nss ) #NEWLINE# for n in segment_data [ i ] . dtype . names : #NEWLINE# #INDENT# self . segment_data [ i ] [ n ] = segment_data [ i ] [ n ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( ( len ( self . segment_data [ 0 ] ) == 1 ) or ( ( np . diff ( self . segment_data [ 0 ] . nseg ) . max ( ) != 0 ) and ( np . diff ( self . segment_data [ 0 ] . outseg ) . max ( ) != 0 ) ) ) : #NEWLINE# #INDENT# self . get_outreaches ( ) #NEWLINE# #UNINDENT# self . channel_geometry_data = channel_geometry_data #NEWLINE# self . channel_flow_data = channel_flow_data #NEWLINE# self . dataset_5 = dataset_5 #NEWLINE# self . outsegs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . outlets = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# assert ( isfropt in [ 0 , 1 , 2 , 3 , 4 , 5 ] ) #NEWLINE# self . parent . add_package ( self )