Ignore:
Timestamp:
Aug 18, 2008, 9:29:57 AM (16 years ago)
Author:
duncan
Message:

Current Hinwood - calc norm set up for _G end tag comparison

Location:
anuga_work/development/Hinwood_2008
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/Hinwood_2008/calc_norm.py

    r5659 r5664  
    131131                 
    132132def plot_rrms_sensor_settings(run_data, outputdir_tags, quantity,
    133               save_as=None,
     133              save_as=True,
    134134              is_interactive=False, max_rmsd=None):
    135135    """
     
    140140    from anuga.shallow_water.data_manager import csv2dict
    141141
    142     # TODO
    143     # scale the plot
     142
    144143    plot_type = ".pdf"
    145144   
     
    196195    close()
    197196
     197def 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       
     211def 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
    198273# Return a bunch of lists
    199274# The err files, for all scenarios
     
    317392    #scenarios = [scenarios[0]] # !!!!!!!!!!!!!!!!!!!!!!
    318393    #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')
    321397   
    322398    #scenarios = [scenarios[0]] # !!!!!!!!!!!!!!!!!!!!!!
    323     auto_plot_rrms_sensor_settings(outputdir_tags, scenarios, "stage")
     399    #auto_plot_rrms_sensor_settings(outputdir_tags, scenarios, "stage")
    324400    #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  
    1515                     legend_exp='Measured flume result',
    1616                     is_interactive=False,
    17                      use_axis=None):
     17                     x_axis=None,
     18                     y_axis=None):
    1819    """
    1920    """
     
    4748    legend((legend_sim, legend_exp),'upper left')
    4849    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])
    5152   
     53    if y_axis is not None:
     54        axis(ymin=y_axis[0], ymax=y_axis[1])
     55       
    5256    if is_interactive:
    5357        # Wait for enter pressed
     
    109113        #location_exps = [location_exps[0]]
    110114        #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']):
    115121            time_date = strftime('plot date: %d/%m/%Y Time: %H:%M:%S',
    116122                                      localtime())
    117123            plot_title = "Scenario: " + outputdir_name + "\n" + \
    118124                         "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']
    119129            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       
    121132            else:
    122                 use_axis = None
     133                y_axis = [run_data['axis'][2] + gauge_elev,
     134                          run_data['axis'][3] + gauge_elev]
    123135            print "Doing ", plot_title
    124136            plot_compare_csv(location_sim=loc_sim,
     
    130142                             is_interactive=is_interactive,
    131143                             save_as=save_as,
    132                              use_axis=use_axis)
     144                             x_axis=x_axis,
     145                             y_axis=y_axis)
    133146            if is_interactive is True:
    134147                break
     
    146159    #outputdir_tag = "_test_C"
    147160    #scenarios = scenarios[1:]
    148     #scenarios = [scenarios[4]]
     161    #scenarios = [scenarios[7]]
    149162    is_interactive = False
    150163    #is_interactive = True
  • anuga_work/development/Hinwood_2008/run_dam.py

    r5616 r5664  
    310310   
    311311    run_type = 1
    312     #run_type = 4
     312    run_type = 4
    313313    #for run_data in [scenarios[5]]:
    314314    #scenarios = scenarios[3:]
     
    324324                             outputdir_name=run_data['scenario_id'],
    325325                             use_limits=False,
    326                              friction=0.012,
    327                              end_tag='_H')
     326                             friction=0.0,
     327                             end_tag='_I')
    328328        #gauges_for_slope(pro_instance.outputdir,[run_data])
  • anuga_work/development/Hinwood_2008/scenarios.py

    r5659 r5664  
    3636        'ANUGA_start_time':1.83,
    3737        'band_offset':-1.0,
    38         'wave_times':[23.0,59.0]
     38        'wave_times':[23.0,59.0]  # this is in Anuga time
    3939                 }
    4040scenarios.append(data)
     
    6262        'ANUGA_start_time':0.38,
    6363        'band_offset':-0.5,
    64         'wave_times':[20.0,59.0]
     64        'wave_times':[20.0,59.0] # this is in Anuga time
    6565        }
    6666scenarios.append(data)
     
    9090        'ANUGA_start_time':0.05,
    9191        'band_offset':2.0,
    92         'wave_times':[15.0,60.0]
     92        'wave_times':[15.0,64.0] # this is in Anuga time
    9393                 }
    9494scenarios.append(data)
     
    117117        'ANUGA_start_time':0.04,
    118118        'band_offset':-2.0,
    119         'wave_times':[34.0,70.0]
     119        'wave_times':[34.0,74.0] # this is in Anuga time
    120120        }
    121121scenarios.append(data)
     
    151151        'ANUGA_start_time':12.18,
    152152        'band_offset':-0.5,
    153         'wave_times':[30.0,65.0]
     153        'wave_times':[30.0,85.0] # this is in Anuga time
    154154        }
    155155scenarios.append(data)
     
    184184        'ANUGA_start_time':10.48,
    185185        'band_offset':-2.0,
    186         'wave_times':[30.0,65.0]
     186        'wave_times':[30.0,74.0] # this is in Anuga time
    187187                 }
    188188scenarios.append(data)
     
    218218        'ANUGA_start_time':11.63,
    219219        'band_offset':-0.5,
    220         'wave_times':[34.0,70.0]
     220        'wave_times':[34.0,75.0] # this is in Anuga time
    221221        }
    222222scenarios.append(data)
     
    252252        'ANUGA_start_time':12.68,
    253253        'band_offset':-1.0,
    254         'wave_times':[34.0,70.0]
    255         }
    256 scenarios.append(data)
     254        'wave_times':[34.0,75.0] # this is in Anuga time
     255        }
     256scenarios.append(data)
Note: See TracChangeset for help on using the changeset viewer.