Changeset 5455
- Timestamp:
- Jul 1, 2008, 3:48:00 PM (16 years ago)
- Location:
- anuga_work/development/Hinwood_2008
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/Hinwood_2008/plot.py
r5449 r5455 18 18 """ 19 19 from pylab import ion, plot, xlabel, ylabel, close, legend, \ 20 savefig, title 20 savefig, title, axis 21 21 from anuga.shallow_water.data_manager import csv2dict 22 22 … … 44 44 legend((legend_sim, legend_exp),'upper left') 45 45 title(plot_title) 46 #axis([0,60,0.380,0.420]) 46 47 47 48 if is_interactive: … … 55 56 close() 56 57 57 def Hinwood_files_locations(run_data, outputdir_tag, plot_type): 58 58 def Hinwood_files_locations(run_data, outputdir_tag, plot_type, 59 quantity = "depth"): 60 """ 61 run_data is a dictionary of data describing a Hinwood experiment 62 outputdir_tag a string at the end of an output dir; '_good_tri_area_0.01_A' 63 plot_type the file extension of the plot, eg '.pdf' 64 """ 59 65 id = run_data['scenario_id'] 60 66 outputdir_name = id + outputdir_tag … … 62 68 outputdir_name=outputdir_name) 63 69 64 file_sim = pro_instance.outputdir + "depth_" + id + ".csv"70 file_sim = pro_instance.outputdir + quantity + "_" + id + ".csv" 65 71 #print "file_exp",file_exp 66 file_exp = pro_instance.raw_data_dir + sep + id + 'pressfilt_exp_depth.csv' 72 file_exp = pro_instance.raw_data_dir + sep + id + 'pressfilt_exp_' \ 73 + quantity + '.csv' 67 74 #print "file_sim", file_sim 68 75 location_sims = [] … … 74 81 location_exps.append(gauge_x) 75 82 save_as_list.append(pro_instance.plots_dir + sep + \ 76 outputdir_name + "_" + gauge_x + plot_type) 83 outputdir_name + "_" + quantity + "_" + \ 84 gauge_x + plot_type) 77 85 return file_exp, file_sim, location_sims, location_exps, outputdir_name, \ 78 86 save_as_list 79 def plot(): 80 from scenarios import scenarios 81 outputdir_tag = "_good_tri_area_0.01_A" 82 outputdir_tag = "_test" 83 #scenarios = scenarios[1] # !!!!!!!!!!!!!!!!!!!!!! 84 #scenarios = [scenarios[5]] # !!!!!!!!!!!!!!!!!!!!!! 85 # Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz. 87 def plot(scenarios, outputdir_tag, quantity = "stage"): 86 88 plot_type = ".pdf" 89 87 90 for run_data in scenarios: 88 91 89 temp = Hinwood_files_locations(run_data, outputdir_tag, plot_type) 92 temp = Hinwood_files_locations(run_data, outputdir_tag, 93 plot_type, quantity) 94 90 95 file_exp, file_sim, location_sims, location_exps, outputdir_name, \ 91 96 save_as_list = temp … … 109 114 file_exp=file_exp, 110 115 plot_title=plot_title, 111 y_label='Water height(m)',116 y_label='Water '+ quantity +' (m)', 112 117 is_interactive=False, 113 118 save_as=save_as) … … 118 123 """ 119 124 from scenarios import scenarios 120 outputdir_tag = "_good_tri_area_0.01_A" 121 #scenarios = scenarios[1] # !!!!!!!!!!!!!!!!!!!!!! 122 scenarios = [scenarios[5]] # !!!!!!!!!!!!!!!!!!!!!! 123 # Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz. 124 plot_type = ".pdf" 125 for run_data in scenarios: 126 127 temp = Hinwood_files_locations(run_data, outputdir_tag, plot_type) 128 file_exp, file_sim, location_sims, location_exps, outputdir_name, \ 129 save_as_list = temp 130 print "run_data['scenario_id']", run_data['scenario_id'] 131 #location_sims = [location_sims[0]] 132 #location_exps = [location_exps[0]] 133 #save_as_list = [save_as_list[0]] 134 for loc_sim, loc_exp, save_as, gauge in map(None, location_sims, 135 location_exps, 136 save_as_list, 137 run_data['gauge_x']): 138 time_date = strftime('plot date: %d/%m/%Y Time: %H:%M:%S', 139 localtime()) 140 plot_title = "Scenario: " + outputdir_name + "\n" + \ 141 "X Gauge (m):" + str(gauge) + " " + time_date 142 143 print "Doing ", plot_title 144 plot_compare_csv(location_sim=loc_sim, 145 file_sim=file_sim, 146 location_exp=loc_exp, 147 file_exp=file_exp, 148 plot_title=plot_title, 149 y_label='Water height (m)', 150 is_interactive=False, 151 save_as=save_as) 125 outputdir_tag = "_test_C" 126 #scenarios = scenarios[1] 127 #scenarios = [scenarios[5]] 128 plot(scenarios, outputdir_tag) 152 129 -
anuga_work/development/Hinwood_2008/prepare_time_boundary.py
r5395 r5455 1 1 """ 2 3 2 Script for running a breaking wave simulation of Jon Hinwoods wave tank. 4 3 Note: this is based on the frinction_ua_flume_2006 structure. … … 6 5 7 6 Duncan Gray, GA - 2007 8 9 10 7 11 8 """ … … 203 200 #print "start_time", start_time 204 201 202 203 bed_elevation_list = metadata_dic['gauge_bed_elevation'] 204 # +2 due to Time column and gauge A 205 max_j = len(bed_elevation_list)+2 205 206 # Write a header 206 207 fid.write('Time') … … 212 213 # Don't write sensor A. 213 214 # It is the boundary condition. 214 for j, bed_elevation in map(None,xrange(2,len(sensors[0])), 215 metadata_dic['gauge_bed_elevation']): 215 for j, bed_elevation in map(None, 216 xrange(2,max_j), 217 bed_elevation_list): 216 218 # depth, m 217 219 gauge = sensors[i,j]/1000 - bed_elevation # Convert from mm to m … … 219 221 fid.write('\n') 220 222 fid.close() 223 224 225 # Since there is a new time reference save the stage info using this 226 # new reference. 227 fid = open(depth_file[:-4] + '_exp_stage.csv','w') 228 sensors[:,0] -= start_time 229 230 # Write a header 231 fid.write('Time') 232 for gauge_x in metadata_dic['gauge_x']: 233 fid.write(',' + str(gauge_x)) 234 fid.write('\n') 235 for i in xrange(len(dtimes)): 236 fid.write(str(sensors[i,0])) # Time 237 # Don't write sensor A. 238 # It is the boundary condition. 239 for j in xrange(2,max_j): 240 # stage, m 241 gauge = sensors[i,j]/1000 # Convert from mm to m 242 fid.write(',' + str(gauge)) 243 fid.write('\n') 244 fid.close() 245 221 246 return final_time 222 247 -
anuga_work/development/Hinwood_2008/run_dam.py
r5449 r5455 66 66 basename = 'zz_' + metadata_dic['scenario_id'] 67 67 if run_type == 1: 68 outputdir_name += '_test '68 outputdir_name += '_test_C' 69 69 yieldstep = 1.0 70 70 finaltime = 15. … … 83 83 maximum_triangle_area=0.001 84 84 elif run_type == 4: 85 outputdir_name += '_good_tri_area_0.01_ A'85 outputdir_name += '_good_tri_area_0.01_C' 86 86 # this is not a test 87 87 # Output will go to a file … … 91 91 maximum_triangle_area=0.01 92 92 elif run_type == 5: 93 outputdir_name += '_good_tri_area_0.001_ A'93 outputdir_name += '_good_tri_area_0.001_C' 94 94 # this is not a test 95 95 # Output will go to a file … … 98 98 finaltime = None 99 99 maximum_triangle_area=0.001 100 elif run_type == 6:101 outputdir_name += '_good_tri_area_0.0001_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.0001108 100 109 101 metadata_dic = set_z_origin_to_water_depth(metadata_dic) … … 231 223 232 224 if run_type >= 1: 233 id = metadata_dic['scenario_id'] 225 id = metadata_dic['scenario_id'] + ".csv" 234 226 interpolate_sww2csv(pro_instance.outputdir + basename +".sww", 235 227 points, 236 pro_instance.outputdir + "depth_" + id + ".csv", 237 pro_instance.outputdir + "velocity_x_" + id + ".csv", 238 pro_instance.outputdir + "velocity_y_" + id + ".csv") 228 pro_instance.outputdir + "depth_" + id, 229 pro_instance.outputdir + "velocity_x_" + id, 230 pro_instance.outputdir + "velocity_y_" + id, 231 pro_instance.outputdir + "stage_" + id) 239 232 240 233 return pro_instance … … 254 247 255 248 256 #4 is 0.01 5 is 0.001 257 run_type = 5 249 # 4 is 0.01 250 # 5 is 0.001 251 run_type = 1 258 252 #for run_data in [scenarios[5]]: 259 253 for run_data in scenarios: 260 main( run_data['scenario_id'] + '_boundary.tsm' , run_data,261 run_type = run_type,262 outputdir_name=run_data['scenario_id'])263 gauges_for_slope()264 #plot()254 pro_instance = main( run_data['scenario_id'] + '_boundary.tsm' , 255 run_data, 256 run_type = run_type, 257 outputdir_name=run_data['scenario_id']) 258 gauges_for_slope(pro_instance.outputdir,[run_data]) -
anuga_work/development/Hinwood_2008/slope.py
r5449 r5455 85 85 xlabel('x location') 86 86 ylabel('Time, seconds') 87 axis([5.0, 5.5, 30, 60])87 #axis([5.0, 5.5, 30, 60]) 88 88 89 89 … … 104 104 105 105 outputdir_tag = "_good_tri_area_0.01_A" 106 outputdir_tag = "_test" 106 outputdir_tag = "_good_tri_area_0.01_old" 107 #outputdir_tag = "_test" 107 108 scenarios = [scenarios[1]] # !!!!!!!!!!!!!!!!!!!!!! 108 109 for run_data in scenarios: … … 112 113 outputdir_name=outputdir_name) 113 114 end = id + ".csv" 114 slope_file = pro_instance.outputdir + " d3slope_stage_" + end115 slope_file = pro_instance.outputdir + "bslope_stage_" + end 115 116 graph_slopes(slope_file, run_data['break_xs'], 116 117 run_data['break_times']) 117 118 118 def gauges_for_slope(): 119 from scenarios import scenarios 119 def gauges_for_slope(outputdir_tag, scenarios): 120 120 121 121 outputdir_tag = "_good_tri_area_0.01_A" 122 outputdir_tag = "_test"123 #scenarios = [scenarios[ 1]] # !!!!!!!!!!!!!!!!!!!!!!124 dx = 0.0 05122 #outputdir_tag = "_test" 123 #scenarios = [scenarios[0]] # !!!!!!!!!!!!!!!!!!!!!! 124 dx = 0.05 125 125 for run_data in scenarios: 126 126 point_x = arange(run_data['start_slope_x'], … … 140 140 interpolate_sww2csv(pro_instance.outputdir + basename +".sww", 141 141 points, 142 pro_instance.outputdir + " eslope_depth_" + end,143 pro_instance.outputdir + " eslope_velocity_x_" + end,144 pro_instance.outputdir + " eslope_velocity_y_" + end,145 pro_instance.outputdir + " eslope_stage_" + end,142 pro_instance.outputdir + "fslope_depth_" + end, 143 pro_instance.outputdir + "fslope_velocity_x_" + end, 144 pro_instance.outputdir + "fslope_velocity_y_" + end, 145 pro_instance.outputdir + "fslope_stage_" + end, 146 146 time_thinning=1) 147 147 … … 153 153 """ 154 154 """ 155 #gauges_for_slope() 156 auto_graph_slopes() 155 from scenarios import scenarios 156 scenarios = [scenarios[0]] 157 #gauges_for_slope("_good_tri_area_0.01_A", scenarios) 158 #auto_graph_slopes() 157 159
Note: See TracChangeset
for help on using the changeset viewer.