#NEWLINE# def test_sfrcheck( ) : #NEWLINE# #INDENT# if ( os . path . split ( os . getcwd ( ) ) [ ( - 1 ) ] == 'flopy3' ) : #NEWLINE# #INDENT# path = os . path . join ( 'examples' , 'data' , 'mf2005_test' ) #NEWLINE# cpth = os . path . join ( 'py.test/temp' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# path = os . path . join ( '..' , 'examples' , 'data' , 'mf2005_test' ) #NEWLINE# cpth = os . path . join ( 'temp' ) #NEWLINE# #UNINDENT# m = flopy . modflow . Modflow . load ( 'test1tr.nam' , model_ws = path , verbose = False ) #NEWLINE# m . model_ws = cpth #NEWLINE# fpth = 'SFRchecker_results.txt' #NEWLINE# m . sfr . check ( fpth , level = 0 ) #NEWLINE# chk = check ( m . sfr ) #NEWLINE# chk . numbering ( ) #NEWLINE# assert ( 'continuity in segment and reach numbering' in chk . passed ) #NEWLINE# chk . routing ( ) #NEWLINE# assert ( 'circular routing' in chk . passed ) #NEWLINE# chk . overlapping_conductance ( ) #NEWLINE# assert ( 'overlapping conductance' in chk . warnings ) #NEWLINE# chk . elevations ( ) #NEWLINE# for test in [ 'segment elevations' , 'reach elevations' , 'reach elevations vs. grid elevations' ] : #NEWLINE# #INDENT# assert ( test in chk . passed ) #NEWLINE# #UNINDENT# chk . slope ( ) #NEWLINE# assert ( 'minimum slope' in chk . passed ) #NEWLINE# m . sfr . segment_data [ 0 ] [ 'nseg' ] [ ( - 1 ) ] += 1 #NEWLINE# m . sfr . reach_data [ 'ireach' ] [ 3 ] += 1 #NEWLINE# m . sfr . segment_data [ 0 ] [ 'outseg' ] [ 1 ] = 1 #NEWLINE# m . sfr . segment_data [ 0 ] [ 'outseg' ] #NEWLINE# chk = check ( m . sfr ) #NEWLINE# chk . numbering ( ) #NEWLINE# assert ( 'continuity in segment and reach numbering' in chk . errors ) #NEWLINE# chk . routing ( ) #NEWLINE# assert ( 'circular routing' in chk . errors ) #NEWLINE# sfr_items = { #NEWLINE# #INDENT# 0 : { #NEWLINE# #INDENT# 'mfnam' : 'test1ss.nam' , #NEWLINE# 'sfrfile' : 'test1ss.sfr' , #NEWLINE# #UNINDENT# } , #NEWLINE# 1 : { #NEWLINE# #INDENT# 'mfnam' : 'test1tr.nam' , #NEWLINE# 'sfrfile' : 'test1tr.sfr' , #NEWLINE# #UNINDENT# } , #NEWLINE# 2 : { #NEWLINE# #INDENT# 'mfnam' : 'testsfr2_tab.nam' , #NEWLINE# 'sfrfile' : 'testsfr2_tab_ICALC1.sfr' , #NEWLINE# #UNINDENT# } , #NEWLINE# 3 : { #NEWLINE# #INDENT# 'mfnam' : 'testsfr2_tab.nam' , #NEWLINE# 'sfrfile' : 'testsfr2_tab_ICALC2.sfr' , #NEWLINE# #UNINDENT# } , #NEWLINE# 4 : { #NEWLINE# #INDENT# 'mfnam' : 'testsfr2.nam' , #NEWLINE# 'sfrfile' : 'testsfr2.sfr' , #NEWLINE# #UNINDENT# } , #NEWLINE# 5 : { #NEWLINE# #INDENT# 'mfnam' : 'UZFtest2.nam' , #NEWLINE# 'sfrfile' : 'UZFtest2.sfr' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# passed = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# warnings = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( i , case ) in sfr_items . items ( ) : #NEWLINE# #INDENT# chk = load_check_sfr ( case [ 'mfnam' ] , model_ws = path , checker_output_path = cpth ) #NEWLINE# passed [ i ] = chk . passed #NEWLINE# warnings [ i ] = chk . warnings #NEWLINE# #UNINDENT# assert ( 'overlapping conductance' in warnings [ 1 ] ) #NEWLINE# assert ( 'segment elevations vs. model grid' in warnings [ 2 ] )