Changeset 5410
- Timestamp:
- Jun 20, 2008, 3:50:27 PM (15 years ago)
- Location:
- anuga_work/development/Hinwood_2008
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/Hinwood_2008/plot.py
r5399 r5410 1 1 2 def plot_compare_csv(location_sim, file_sim, location_exp, file_exp, y_label, 2 """ 3 Plot up files from the Hinwood project. 4 """ 5 from os import sep 6 import project 7 8 def plot_compare_csv(location_sim, file_sim, location_exp, file_exp, 9 y_label, 3 10 save_as=None, 11 plot_title="", 4 12 x_label='Time (s)', 5 13 legend_sim='ANUGA simulation', … … 9 17 """ 10 18 from pylab import ion, plot, xlabel, ylabel, close, legend, \ 11 savefig 19 savefig, title 12 20 from anuga.shallow_water.data_manager import csv2dict 13 21 … … 17 25 simulation, _ = csv2dict(file_sim) 18 26 experiment, _ = csv2dict(file_exp) 19 time_sim = [float(x) for x in simulation[' Time']]27 time_sim = [float(x) for x in simulation['time']] 20 28 quantity_sim = [float(x) for x in simulation[location_sim]] 21 29 #print "quantity_sim", quantity_sim 22 time_exp = [float(x) for x in experiment[' time']]30 time_exp = [float(x) for x in experiment['Time']] 23 31 quantity_exp = [float(x) for x in experiment[location_exp]] 24 32 … … 31 39 xlabel(x_label) 32 40 ylabel(y_label) 33 legend((legend_sim, legend_exp)) 41 # The order defines the label 42 #legend((legend_exp, legend_sim),'upper left') 43 legend((legend_sim, legend_exp),'upper left') 44 title(plot_title) 34 45 35 46 if is_interactive: … … 43 54 close() 44 55 45 56 def Hinwood_files_locations(run_data, outputdir_tag, plot_type): 57 58 id = run_data['scenario_id'] 59 outputdir_name = id + outputdir_tag 60 pro_instance = project.Project(['data','flumes','Hinwood_2008'], 61 outputdir_name=outputdir_name) 62 63 file_sim = pro_instance.outputdir + "depth_" + id + ".csv" 64 #print "file_exp",file_exp 65 file_exp = pro_instance.raw_data_dir + sep + id + 'pressfilt_exp_depth.csv' 66 #print "file_sim", file_sim 67 location_sims = [] 68 location_exps = [] 69 save_as_list = [] 70 for gauge_x in run_data['gauge_x']: 71 gauge_x = str(gauge_x) 72 location_sims.append(gauge_x + ':0.5') 73 location_exps.append(gauge_x) 74 save_as_list.append(pro_instance.plots_dir + sep + \ 75 outputdir_name + "_" + gauge_x + plot_type) 76 return file_exp, file_sim, location_sims, location_exps, outputdir_name, \ 77 save_as_list 46 78 47 79 #------------------------------------------------------------- … … 49 81 """ Plot the stage graph for the ANUGA validation papar 50 82 """ 83 from scenarios import scenarios 84 outputdir_tag = "_good_tri_area_0.001_A" 85 #scenarios = [scenarios[0]] # !!!!!!!!!!!!!!!!!!!!!! 86 # Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz. 87 plot_type = ".pdf" 88 for run_data in scenarios: 89 90 temp = Hinwood_files_locations(run_data, outputdir_tag, plot_type) 91 file_exp, file_sim, location_sims, location_exps, outputdir_name, \ 92 save_as_list = temp 93 for loc_sim, loc_exp, save_as, gauge in map(None, location_sims, 94 location_exps, 95 save_as_list, 96 run_data['gauge_x']): 97 plot_title = "Scenario: " + outputdir_name + "\n" + \ 98 "X Gauge (m):" + str(gauge) 99 print "Doing ", plot_title 100 plot_compare_csv(location_sim=loc_sim, 101 file_sim=file_sim, 102 location_exp=loc_exp, 103 file_exp=file_exp, 104 plot_title=plot_title, 105 y_label='Water height (m)', 106 is_interactive=False, 107 save_as=save_as) 51 108 52 import project53 import shutil54 from os import sep, path55 56 57 # T1R558 run_data = {'xleft':[-3.106,0.0], # Av' of ADV and Gauge A59 'xtoe':[0.0,0.0],60 'xbeach':[1.285,0.090],61 'xright':[16.1,.960],62 'offshore_water_depth':.4,63 'scenario_id':'T1R5',64 'gauge_names':['B','1','2','3','4','5','6','7','8',65 '9','10','11','12','13','14'],66 'gauge_x':[-0.68, 1.572, 2.572, 3.572, 4.572, 5.572,67 6.572, 7.572, 8.572, 9.572, 10.572, 11.572,68 12.572, 13.572, 14.572],69 'gauge_bed_elevation':[-0.400000, -0.293158,70 -0.234473, -0.175788, -0.117104, -0.058419, 0.000266,71 0.058950, 0.117635, 0.176320, 0.235004, 0.293689,72 0.352374, 0.411058, 0.469743]73 }74 id = run_data['scenario_id']75 outputdir_name = id + "_test_long_time"76 pro_instance = project.Project(['data','flumes','Hinwood_2008'],77 outputdir_name=outputdir_name)78 79 file_exp = pro_instance.outputdir + "depth_" + id + ".csv"80 print "file_exp",file_exp81 file_sim = pro_instance.raw_data_dir + sep + id + 'pressfilt_exp_depth.csv'82 print "file_sim", file_sim83 location_sim = str(run_data['gauge_x'][0])84 location_exp = str(run_data['gauge_x'][0]) + ':0.225'85 # create Depth plot86 plot_compare_csv(location_sim=location_sim,87 file_sim=file_sim,88 location_exp=location_exp,89 file_exp=file_exp,90 y_label='Water height (m)',91 is_interactive=True)92 #save_as="me.eps")93 -
anuga_work/development/Hinwood_2008/project.py
r5392 r5410 40 40 self.boundarydir = self.outputdir 41 41 self.raw_data_dir = join(scenariodir, 'raw_data') 42 self.plots_dir = join(scenariodir, 'plots') 42 43 43 44 # creates copy of output dir structure, if it doesn't exist … … 48 49 if not access(self.outputdir,F_OK): 49 50 mkdir (self.outputdir) 51 if not access(self.plots_dir,F_OK): 52 mkdir (self.plots_dir) 50 53 51 54 self.codedir = getcwd()+sep -
anuga_work/development/Hinwood_2008/run_dam.py
r5405 r5410 83 83 maximum_triangle_area=0.001 84 84 elif run_type == 4: 85 outputdir_name += '_good_tri_area_0.01_A' 86 # this is not a test 87 # Output will go to a file 88 # The sww file will be interpolated 89 yieldstep = 0.01 90 finaltime = None 91 maximum_triangle_area=0.01 92 elif run_type == 5: 85 93 outputdir_name += '_good_tri_area_0.001_A' 86 94 # this is not a test … … 90 98 finaltime = None 91 99 maximum_triangle_area=0.001 92 elif run_type == 5:100 elif run_type == 6: 93 101 outputdir_name += '_good_tri_area_0.0001_A' 94 102 # this is not a test … … 98 106 finaltime = None 99 107 maximum_triangle_area=0.0001 100 elif run_type == 6:101 outputdir_name += '_good_tri_area_0.01_A'102 # this is not a test103 # Output will go to a file104 # The sww file will be interpolated105 yieldstep = 0.01106 finaltime = None107 maximum_triangle_area=0.01108 108 109 109 metadata_dic = set_z_origin_to_water_depth(metadata_dic) … … 125 125 if finaltime is None: 126 126 finaltime = boundary_final_time 127 128 127 # Boundary file manipulation 129 128 if boundary_path is None: … … 276 275 277 276 # T1R3 278 run_data['scenario_id'] = 'T1R3' 277 run_data = {'xleft':[-3.106,0.0], # Av' of ADV and Gauge A 278 'xtoe':[0.0,0.0], 279 'xbeach':[1.285,0.090], 280 'xright':[16.1,.960], 281 'offshore_water_depth':.4, 282 'scenario_id':'T1R3', 283 'gauge_names':['B','1','2','3','4','5','6','7','8', 284 '9','10','11','12','13','14'], 285 'gauge_x':[-0.68, 1.572, 2.572, 3.572, 4.572, 5.572, 286 6.572, 7.572, 8.572, 9.572, 10.572, 11.572, 287 12.572, 13.572, 14.572], 288 'gauge_bed_elevation':[-0.400000, -0.293158, 289 -0.234473, -0.175788, -0.117104, -0.058419, 0.000266, 290 0.058950, 0.117635, 0.176320, 0.235004, 0.293689, 291 0.352374, 0.411058, 0.469743] 292 } 279 293 main( run_data['scenario_id'] + '_boundary.tsm' , run_data, 280 294 run_type = run_type,
Note: See TracChangeset
for help on using the changeset viewer.