#NEWLINE# def overlapping_conductance( self , tol = 1e-06 ) : #NEWLINE# #INDENT# 'checks for multiple SFR reaches in one cell; and whether more than one reach has Cond > 0\n        ' #NEWLINE# headertxt = 'Checking for model cells with multiple non-zero SFR conductances...\n' #NEWLINE# txt = '' #NEWLINE# if self . verbose : #NEWLINE# #INDENT# print ( headertxt . strip ( ) ) #NEWLINE# #UNINDENT# reach_data = self . reach_data . copy ( ) #NEWLINE# if ( np . diff ( reach_data . node ) . max ( ) == 0 ) : #NEWLINE# #INDENT# uniquerc = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( i , ( r , c ) ) in enumerate ( reach_data [ [ 'i' , 'j' ] ] ) : #NEWLINE# #INDENT# if ( ( r , c ) not in uniquerc ) : #NEWLINE# #INDENT# uniquerc [ ( r , c ) ] = ( i + 1 ) #NEWLINE# #UNINDENT# #UNINDENT# reach_data [ 'node' ] = [ uniquerc [ ( r , c ) ] for ( r , c ) in reach_data [ [ 'i' , 'j' ] ] ] #NEWLINE# #UNINDENT# K = reach_data . strhc1 #NEWLINE# if ( K . max ( ) == 0 ) : #NEWLINE# #INDENT# K = self . sfr . _interpolate_to_reaches ( 'hcond1' , 'hcond2' ) #NEWLINE# #UNINDENT# b = reach_data . strthick #NEWLINE# if ( b . max ( ) == 0 ) : #NEWLINE# #INDENT# b = self . sfr . _interpolate_to_reaches ( 'thickm1' , 'thickm2' ) #NEWLINE# #UNINDENT# L = reach_data . rchlen #NEWLINE# w = self . sfr . _interpolate_to_reaches ( 'width1' , 'width2' ) #NEWLINE# Cond = ( ( ( K * w ) * L ) / b ) #NEWLINE# shared_cells = _get_duplicates ( reach_data . node ) #NEWLINE# nodes_with_multiple_conductance = set ( ) #NEWLINE# for node in shared_cells : #NEWLINE# #INDENT# conductances = Cond [ ( reach_data . node == node ) ] . copy ( ) #NEWLINE# conductances . sort ( ) #NEWLINE# if ( ( conductances [ 0 ] / conductances [ ( - 1 ) ] ) > tol ) : #NEWLINE# #INDENT# nodes_with_multiple_conductance . update ( { node } ) #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( nodes_with_multiple_conductance ) > 0 ) : #NEWLINE# #INDENT# txt += '{} model cells with multiple non-zero SFR conductances found.\nThis may lead to circular routing between collocated reaches.\n' . format ( len ( nodes_with_multiple_conductance ) ) #NEWLINE# if ( self . level == 1 ) : #NEWLINE# #INDENT# txt += 'Nodes with overlapping conductances:\n' #NEWLINE# reach_data [ 'strthick' ] = b #NEWLINE# reach_data [ 'strhc1' ] = K #NEWLINE# cols = [ c for c in reach_data . dtype . names if ( c in [ 'node' , 'k' , 'i' , 'j' , 'iseg' , 'ireach' , 'rchlen' , 'strthick' , 'strhc1' ] ) ] #NEWLINE# reach_data = recfunctions . append_fields ( reach_data , names = [ 'width' , 'conductance' ] , data = [ w , Cond ] , usemask = False , asrecarray = True ) #NEWLINE# has_multiple = np . array ( [ ( True if ( n in nodes_with_multiple_conductance ) else False ) for n in reach_data . node ] ) #NEWLINE# reach_data = reach_data [ has_multiple ] . copy ( ) #NEWLINE# reach_data = reach_data [ cols ] . copy ( ) #NEWLINE# txt += _print_rec_array ( reach_data , delimiter = '\t' ) #NEWLINE# #UNINDENT# #UNINDENT# self . _txt_footer ( headertxt , txt , 'overlapping conductance' )