Changeset 4417
- Timestamp:
- Apr 24, 2007, 10:00:17 AM (18 years ago)
- Location:
- anuga_validation/automated_validation_tests/urs_mux_files_validation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_validation/automated_validation_tests/urs_mux_files_validation/run_Bf.py
r4410 r4417 17 17 from shutil import copy 18 18 import time, sys, os, tempfile 19 #import sys20 #import os21 #import tempfile22 19 23 20 # Related major packages 24 21 from anuga.shallow_water import Domain,Dirichlet_boundary,File_boundary,Transmissive_boundary, Field_boundary 25 #from anuga.shallow_water.shallow_water_domain import Field_boundary26 22 from Numeric import allclose, array 27 23 from anuga.pmesh.mesh_interface import create_mesh_from_regions 28 24 from anuga.abstract_2d_finite_volumes.util import start_screen_catcher, copy_code_files, sww2timeseries, get_data_from_file 29 #from anuga.caching import myhash30 25 # Application specific imports 31 26 … … 35 30 #------------------------------------------------------------------------------ 36 31 out_dir = dirname(abspath(__file__))+sep 37 #print'temp_name'38 32 fileName="temp" 39 #import sys 40 #sys.exit() 33 41 34 meshes_dir_name = 'small.tsh' # this will be local 42 35 43 36 tide = 2.4 44 45 46 #EVOLVED MODEL47 37 48 38 #-------------------------------------------------------------------------- … … 53 43 #-------------------------------------------------------------------------- 54 44 55 #all = [[469000,7760000],[470000,7758000],[468000,7758000]]56 #all = [[470000,7760000],[469000,7758000],[468000,7760000]]57 58 #all_large = [[474000,7764000],[474000,7756000],[466000,7756000],[466000,7764000]]59 #all = [[470000,7764000],[470000,7756000],[466000,7756000],[466000,7764000]]60 45 all = [[465184,7764500],[470397,7764510],[470407,7758988],[465195,7758979]] 61 46 # N, W, S, E 62 47 63 48 create_mesh_from_regions(all, 64 # boundary_tags={'ocean': [0,1,2]},65 # boundary_tags={'ocean': [ 2],'side': [0, 1]},66 49 boundary_tags={'ocean': [ 0],'side': [1, 3], 'back': [2]}, 67 50 maximum_triangle_area=50000, 68 51 filename=meshes_dir_name, 69 52 use_cache=False, 70 # verbose=True71 53 ) 72 54 … … 124 106 #---------------------------------------------------------------------------- 125 107 126 #remove mesh file!!! and o_test.sww127 108 t0 = time.time() 128 109 … … 132 113 133 114 134 115 #---------------------------------------------------------------------------- 135 116 #Gets timeseries from boundary sww and evolved sww 117 #---------------------------------------------------------------------------- 136 118 home = getenv('INUNDATIONHOME') #Sandpit's parent dir 137 119 data = 'data' … … 164 146 swwfile = out_dir + fileName + '.sww' 165 147 swwfiles[swwfile] = run_time 166 148 #---------------------------------------------------------------------------- 149 #get timeseries data from evolved sww file 150 #---------------------------------------------------------------------------- 167 151 texname, elev_output = sww2timeseries(swwfiles, 168 152 out_dir+sep+"gauges.txt", … … 182 166 swwfiles[swwfile] = run_time 183 167 #print"swwfiles",swwfiles,"shallow_water" 184 168 169 #---------------------------------------------------------------------------- 170 #get timeseries data from boundary sww file 171 #---------------------------------------------------------------------------- 185 172 texname, elev_output = sww2timeseries(swwfiles, 186 173 out_dir+sep+"boundary_gauges.txt", … … 196 183 verbose = False) 197 184 198 #makes the csv files from the evolved model 185 #---------------------------------------------------------------------------- 186 # get_data_from file returns a e_data which is an array containing the data from the 187 # file it read 188 #---------------------------------------------------------------------------- 199 189 e_header, e_data = get_data_from_file(evolved_dir_filename) 200 190 191 # assign columns from array to single vector(arrays) 201 192 e_time = e_data[:,0] 202 193 e_stage = e_data[:,1] … … 205 196 e_elevation = e_data[:,4] 206 197 207 #print'boundary_dir_filename',boundary_dir_filename 198 #---------------------------------------------------------------------------- 199 #get_data_from file returns a b_data which is an array containing the data from the 200 # file it read 201 #---------------------------------------------------------------------------- 208 202 b_header, b_data = get_data_from_file(boundary_dir_filename) 209 203 204 # assign columns from array to single vector(arrays) 210 205 b_time = b_data[:,0] 211 206 b_stage = b_data[:,1] … … 214 209 b_elevation = b_data[:,4] 215 210 216 217 # compares the 2 models 211 #---------------------------------------------------------------------------- 212 # compares the 2 models, make the vector of data from the boundary sww file have the same 213 # time interval as the evolved sww vector. this allows them to be compared with the allclose 214 # statment at the end 215 #---------------------------------------------------------------------------- 218 216 j=0 219 217 k=0 218 #from boundary sww 220 219 b_sample = [] 220 #from evolved sww 221 221 e_sample = [] 222 222 for i in range(len(b_time)): … … 230 230 231 231 232 #print len(b_sample), len(e_stage),e_stage,type(e_stage)233 232 e_stage = e_stage.tolist() 234 233 e_stage.pop() 235 #e_stage.pop() 236 237 #print len(b_sample), len(e_stage),e_stage 238 239 240 #assert allclose (b_sample, e_stage, 0.2, 0.2) 234 235 241 236 print "test successful" 242 237 print 'fileName',fileName+'.sww' 243 #os.remove(fileName+'.sww')244 #print 'evolved_dir_filename',evolved_dir_filename245 #os.remove('gauges_time_series_near_top.csv')246 #os.remove('gauges_time_series_b_near_top.csv')247 #os.remove('gauges_t0.csv')248 #os.remove('gauges_maxmins.csv')249 238 os.remove(meshes_dir_name) 250 251 239 #---------------------------------------------------------------------------- 240 # Compares the two time series 241 #---------------------------------------------------------------------------- 252 242 assert allclose (b_sample, e_sample, 0.5, 0.5) 253 243 -
anuga_validation/automated_validation_tests/urs_mux_files_validation/validate_Bf.py
r4410 r4417 11 11 12 12 class Test_Bf(unittest.TestCase): 13 def test_setUp(self):13 def setUp(self): 14 14 15 15 # Remove garbage … … 24 24 25 25 def test_compare_URSsww_vs_EvolveANUGAsww(self): 26 27 self.setUp() 28 26 29 s = 'run_Bf.py' 27 30 #print s … … 30 33 assert res == 0 31 34 32 def test_cleanUp(self): 35 self.cleanUp() 36 37 def cleanUp(self): 33 38 34 39 # Remove garbage
Note: See TracChangeset
for help on using the changeset viewer.