Changeset 5664
- Timestamp:
- Aug 18, 2008, 9:29:57 AM (16 years ago)
- Location:
- anuga_work/development/Hinwood_2008
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/Hinwood_2008/calc_norm.py
r5659 r5664 131 131 132 132 def plot_rrms_sensor_settings(run_data, outputdir_tags, quantity, 133 save_as= None,133 save_as=True, 134 134 is_interactive=False, max_rmsd=None): 135 135 """ … … 140 140 from anuga.shallow_water.data_manager import csv2dict 141 141 142 # TODO 143 # scale the plot 142 144 143 plot_type = ".pdf" 145 144 … … 196 195 close() 197 196 197 def auto_plot_test_rmsd(scenarios, outputdir_tag, quantity="stage", 198 save_as=True, 199 is_interactive=False, max_rmsd=1.0): 200 201 tests = [] 202 203 for i in range(0,len(scenarios),2): 204 tests.append([scenarios[i], scenarios[i+1]]) 205 206 for test in tests: 207 plot_test_rmsd(test, outputdir_tag, quantity, 208 save_as=save_as, 209 is_interactive=is_interactive, max_rmsd=max_rmsd) 210 211 def plot_test_rmsd(test, outputdir_tag, quantity, 212 save_as=None, 213 is_interactive=False, max_rmsd=None): 214 """ 215 For a test, plot rmsd vs x location for both runs. 216 Also, add the break measurement. 217 """ 218 from pylab import ion, plot, xlabel, ylabel, close, legend, \ 219 savefig, title, axis, setp, subplot, grid, axvspan, figlegend 220 from anuga.shallow_water.data_manager import csv2dict 221 222 plot_type = ".pdf" 223 id = test[0]['scenario_id'][:2] 224 225 if is_interactive: 226 ion() 227 time_date = strftime('plot date: %d/%m/%Y Time: %H:%M:%S', 228 localtime()) 229 #subplot(212) 230 plot_title = id + " Root Mean Square Deviation comparison" + '\n' \ 231 + time_date 232 233 #title(plot_title) 234 y_label = "RMSD" 235 ylabel(y_label) 236 xlabel("x location, m") 237 grid(True) 238 239 lines = [] 240 for run in test: 241 242 outputdir_name = run['scenario_id'] + outputdir_tag 243 pro_instance = project.Project(['data','flumes','Hinwood_2008'], 244 outputdir_name=outputdir_name) 245 246 file_err = pro_instance.rmsd_dir + sep + outputdir_name + "_" \ 247 + quantity + "_err.csv" 248 249 simulation, _ = csv2dict(file_err) 250 locations = [float(x) for x in simulation['x location']] 251 rmsd_list = [float(x) for x in simulation['rmsd']] 252 lines.append(plot(locations, rmsd_list)) 253 254 for break_x in run['break_xs']: 255 axvspan(break_x-0.001,break_x+0.001, facecolor='g') 256 257 if max_rmsd is not None: 258 #print "setting axis" 259 axis(ymin=0, ymax=max_rmsd) 260 261 figlegend(lines, outputdir_tags,'upper left') 262 263 if is_interactive: 264 raw_input() 265 266 save_as = pro_instance.plots_dir + sep + \ 267 id + "_rmsd" + plot_type 268 if save_as is not None: 269 savefig(save_as) 270 271 close() 272 198 273 # Return a bunch of lists 199 274 # The err files, for all scenarios … … 317 392 #scenarios = [scenarios[0]] # !!!!!!!!!!!!!!!!!!!!!! 318 393 #scenarios = scenarios[4:] # !!!!!!!!!!!!!!!!!!!!!! 319 #for outputdir_tag in outputdir_tags: 320 # auto_rrms(outputdir_tag, scenarios, "stage", y_location_tag=':0.0') 394 if False: 395 for outputdir_tag in outputdir_tags: 396 auto_rrms(outputdir_tag, scenarios, "stage", y_location_tag=':0.0') 321 397 322 398 #scenarios = [scenarios[0]] # !!!!!!!!!!!!!!!!!!!!!! 323 auto_plot_rrms_sensor_settings(outputdir_tags, scenarios, "stage")399 #auto_plot_rrms_sensor_settings(outputdir_tags, scenarios, "stage") 324 400 #compare_different_settings(outputdir_tags, scenarios, "stage") 401 402 outputdir_tag = "_nolmts_wdth_0.1_z_0.0_ys_0.01_mta_0.01_G" 403 auto_plot_test_rmsd(scenarios, outputdir_tag) -
anuga_work/development/Hinwood_2008/plot.py
r5659 r5664 15 15 legend_exp='Measured flume result', 16 16 is_interactive=False, 17 use_axis=None): 17 x_axis=None, 18 y_axis=None): 18 19 """ 19 20 """ … … 47 48 legend((legend_sim, legend_exp),'upper left') 48 49 title(plot_title) 49 if use_axis is not None:50 axis( use_axis)50 if x_axis is not None: 51 axis(xmin=x_axis[0], xmax=x_axis[1]) 51 52 53 if y_axis is not None: 54 axis(ymin=y_axis[0], ymax=y_axis[1]) 55 52 56 if is_interactive: 53 57 # Wait for enter pressed … … 109 113 #location_exps = [location_exps[0]] 110 114 #save_as_list = [save_as_list[0]] 111 for loc_sim, loc_exp, save_as, gauge in map(None, location_sims, 112 location_exps, 113 save_as_list, 114 run_data['gauge_x']): 115 for loc_sim, loc_exp, save_as, gauge, gauge_elev in \ 116 map(None, location_sims, 117 location_exps, 118 save_as_list, 119 run_data['gauge_x'], 120 run_data['gauge_bed_elevation']): 115 121 time_date = strftime('plot date: %d/%m/%Y Time: %H:%M:%S', 116 122 localtime()) 117 123 plot_title = "Scenario: " + outputdir_name + "\n" + \ 118 124 "X Gauge (m):" + str(gauge) + " " + time_date 125 126 # When the shore gauges out of the are used, don't 127 # use the standard y axis scale 128 x_axis = run_data['wave_times'] 119 129 if gauge < run_data['axis_maximum_x']: 120 use_axis = run_data['axis'] 130 y_axis = [run_data['axis'][2],run_data['axis'][3]] 131 121 132 else: 122 use_axis = None 133 y_axis = [run_data['axis'][2] + gauge_elev, 134 run_data['axis'][3] + gauge_elev] 123 135 print "Doing ", plot_title 124 136 plot_compare_csv(location_sim=loc_sim, … … 130 142 is_interactive=is_interactive, 131 143 save_as=save_as, 132 use_axis=use_axis) 144 x_axis=x_axis, 145 y_axis=y_axis) 133 146 if is_interactive is True: 134 147 break … … 146 159 #outputdir_tag = "_test_C" 147 160 #scenarios = scenarios[1:] 148 #scenarios = [scenarios[ 4]]161 #scenarios = [scenarios[7]] 149 162 is_interactive = False 150 163 #is_interactive = True -
anuga_work/development/Hinwood_2008/run_dam.py
r5616 r5664 310 310 311 311 run_type = 1 312 #run_type = 4312 run_type = 4 313 313 #for run_data in [scenarios[5]]: 314 314 #scenarios = scenarios[3:] … … 324 324 outputdir_name=run_data['scenario_id'], 325 325 use_limits=False, 326 friction=0.0 12,327 end_tag='_ H')326 friction=0.0, 327 end_tag='_I') 328 328 #gauges_for_slope(pro_instance.outputdir,[run_data]) -
anuga_work/development/Hinwood_2008/scenarios.py
r5659 r5664 36 36 'ANUGA_start_time':1.83, 37 37 'band_offset':-1.0, 38 'wave_times':[23.0,59.0] 38 'wave_times':[23.0,59.0] # this is in Anuga time 39 39 } 40 40 scenarios.append(data) … … 62 62 'ANUGA_start_time':0.38, 63 63 'band_offset':-0.5, 64 'wave_times':[20.0,59.0] 64 'wave_times':[20.0,59.0] # this is in Anuga time 65 65 } 66 66 scenarios.append(data) … … 90 90 'ANUGA_start_time':0.05, 91 91 'band_offset':2.0, 92 'wave_times':[15.0,6 0.0]92 'wave_times':[15.0,64.0] # this is in Anuga time 93 93 } 94 94 scenarios.append(data) … … 117 117 'ANUGA_start_time':0.04, 118 118 'band_offset':-2.0, 119 'wave_times':[34.0,7 0.0]119 'wave_times':[34.0,74.0] # this is in Anuga time 120 120 } 121 121 scenarios.append(data) … … 151 151 'ANUGA_start_time':12.18, 152 152 'band_offset':-0.5, 153 'wave_times':[30.0, 65.0]153 'wave_times':[30.0,85.0] # this is in Anuga time 154 154 } 155 155 scenarios.append(data) … … 184 184 'ANUGA_start_time':10.48, 185 185 'band_offset':-2.0, 186 'wave_times':[30.0, 65.0]186 'wave_times':[30.0,74.0] # this is in Anuga time 187 187 } 188 188 scenarios.append(data) … … 218 218 'ANUGA_start_time':11.63, 219 219 'band_offset':-0.5, 220 'wave_times':[34.0,7 0.0]220 'wave_times':[34.0,75.0] # this is in Anuga time 221 221 } 222 222 scenarios.append(data) … … 252 252 'ANUGA_start_time':12.68, 253 253 'band_offset':-1.0, 254 'wave_times':[34.0,7 0.0]255 } 256 scenarios.append(data) 254 'wave_times':[34.0,75.0] # this is in Anuga time 255 } 256 scenarios.append(data)
Note: See TracChangeset
for help on using the changeset viewer.