Changeset 5681


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

moving Honwood files around

Files:
1 deleted
5 edited
2 moved

Legend:

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

    r5670 r5681  
    2626
    2727from slope import load_sensors
    28 from interp import interp
     28from anuga.utilities.interp import interp
    2929
    3030def get_max_min_condition_array(min, max, vector):
     
    195195    close()
    196196
    197 def auto_plot_test_rmsd(scenarios, outputdir_tag, quantity="stage",
    198               save_as=True,
    199               is_interactive=False, max_rmsd=0.010):
     197def auto_plot_test_rmsd(scenarios, outputdir_tag,
     198                        to_publish_indexes, quantity="stage",
     199              save_as=True,add_run_info=False,
     200              is_interactive=False, max_rmsd=0.012):
    200201    """
    201202    Produce the RMSD graphs for the anuga article.
    202203
    203     to do:
    204     labels
    205204    """
    206205   
     
    209208   
    210209    for i in range(0,len(scenarios),2):
    211         tests.append([scenarios[i], scenarios[i+1]])
     210        if to_publish_indexes.has_key(scenarios[i]['scenario_id']):           
     211            tests.append([scenarios[i], scenarios[i+1]])
     212        else:           
     213            tests.append([scenarios[i+1], scenarios[i]])
    212214
    213215    for test in tests:
    214216        file_name = plot_test_rmsd(test, outputdir_tag, quantity,
    215               save_as=save_as,
    216               is_interactive=is_interactive, max_rmsd=max_rmsd)
     217                                   to_publish_indexes,
     218                                   save_as=save_as, add_run_info=add_run_info,
     219                                   is_interactive=is_interactive,
     220                                   max_rmsd=max_rmsd)
    217221        file_names.append(file_name)
    218222    return file_names
    219223       
    220224def plot_test_rmsd(test, outputdir_tag, quantity,
    221               save_as=None,
    222               is_interactive=False, max_rmsd=None):
     225                   to_publish_indexes,
     226                   save_as=None, add_run_info=False,
     227                   is_interactive=False, max_rmsd=None):
    223228    """
    224229    For a test, plot rmsd vs x location for both runs.
     
    230235       
    231236    plot_type = ".pdf"   
    232     id = test[0]['scenario_id'][:2]
    233    
     237    id = 'S' + test[0]['scenario_id'][1:2]
     238   
     239    if add_run_info is True:
     240        plot_title = "Title will not be in final draft \n" + \
     241                     id + outputdir_tag
     242       
     243        title(plot_title)
     244    else:
     245        plot_title = ""
     246           
    234247    if is_interactive:
    235248        ion()
     
    237250                                      localtime())
    238251    #subplot(212)   
    239     plot_title = id + " Root Mean Square Deviation comparison" + '\n' \
    240                  + time_date
     252   
    241253                 
    242254    #title(plot_title)
     
    251263    for run in test:
    252264        i += 1
    253         legend_name.append(run['scenario_id'][:2]+"T"+str(i))   
     265        legend_name.append("S" + test[0]['scenario_id'][1:2]+"R"+str(i))   
    254266        outputdir_name = run['scenario_id'] + outputdir_tag
    255267        pro_instance = project.Project(['data','flumes','Hinwood_2008'],
     
    262274        locations = [float(x) for x in simulation['x location']]
    263275        rmsd_list = [float(x) for x in simulation['rmsd']]
    264         lines.append(plot(locations, rmsd_list, '-o'))
    265         #plot(locations, rmsd_list, 'o')
     276
     277       
     278        lines.append(plot(locations, rmsd_list, 'k-x')) # k is black
     279
     280        for i_gauge, (location, rmsd) in enumerate(map(None,
     281                                                     locations,
     282                                                     rmsd_list)):
     283            if to_publish_indexes.has_key(run['scenario_id']) and \
     284                   to_publish_indexes[run['scenario_id']].count(i_gauge) == 1:
     285                plot([location], [rmsd], 'ko', markeredgewidth=2,
     286                     markeredgecolor='k')
     287               
     288
    266289       
    267290        for break_x in run['break_xs']:
     
    272295        axis(ymin=0, ymax=max_rmsd)
    273296       
     297    if id == 'S2':
     298        # Hack to get the desired width
     299        axis(xmax=7.0)
     300       
     301    setp(lines[1], linestyle='--')   
    274302    legend(lines, legend_name,'upper left')
    275303   
     
    278306
    279307    save_as = pro_instance.plots_dir + sep + \
    280               id + "_rmsd" + plot_type
     308              id + "-rmsd" + plot_type
    281309    print "save_as", save_as
    282310    if save_as is not None:
     
    380408                   save_as=None,
    381409                   is_interactive=False):
     410    """
     411    The general auto, for comparing things.
     412
     413    """
    382414    max_rmsd = calc_max_rmsd(scenarios, outputdir_tags, quantity)
    383415    print "max_rmsd", max_rmsd
     
    400432    outputdir_tags.append("_nolmts_wdth_0.1_z_0.012_ys_0.01_mta_0.01_I")
    401433    outputdir_tags.append("_nolmts_wdth_1.0_z_0.0_ys_0.01_mta_0.01_I")
     434    outputdir_tags.append("_nolmts_wdth_0.1_z_0.012_ys_0.01_mta_0.0001_I")
     435    outputdir_tags.append("_lmts_wdth_0.1_z_0.0_ys_0.01_mta_0.0001_I")
     436    outputdir_tags.append("_no_velocity_nolmts_wdth_0.1_z_0.0_ys_0.01_mta_0.0001_I")
    402437   
    403438    #outputdir_tag = "_test_limiterC"
     
    405440    #scenarios = scenarios[4:] # !!!!!!!!!!!!!!!!!!!!!!
    406441    calc_norms = True
    407     calc_norms = False
     442    #calc_norms = False
    408443    if calc_norms:
    409444        for outputdir_tag in outputdir_tags:
     
    412447    #scenarios = [scenarios[0]] # !!!!!!!!!!!!!!!!!!!!!!
    413448    #auto_plot_rrms_sensor_settings(outputdir_tags, scenarios, "stage")
    414     #compare_different_settings(outputdir_tags, scenarios, "stage")
     449    compare_different_settings(outputdir_tags, scenarios, "stage")
    415450
    416451    outputdir_tag = "_nolmts_wdth_0.1_z_0.0_ys_0.01_mta_0.01_I"
    417     auto_plot_test_rmsd(scenarios, outputdir_tag)
     452    #auto_plot_test_rmsd(scenarios, outputdir_tag)
  • anuga_work/development/Hinwood_2008/plot.py

    r5670 r5681  
    156156                                     y_location_tag=':0.0',
    157157                                     add_run_info=False):
     158    """
     159    Used by validation graphs to produce the final figures
     160    """
    158161    plot_type = ".pdf"
    159162    save_as_list = []
     
    180183        #save_as = pro_instance.plots_dir + sep + \
    181184        #          outputdir_name + "_" + quantity + "_" + plot_type
    182         save_as = pro_instance.plots_dir + sep + id + quantity + \
    183                   '_compare' + plot_type
     185        save_as = pro_instance.plots_dir + sep + 'S' + id[1:2] + \
     186                  '-' + quantity + '-compare' + plot_type
    184187        save_as_list.append(save_as)
    185188
     
    210213                                y_axis=None,
    211214                                y_location_tag=':0.0'):
    212     """
     215    """
     216    Used by validation graphs to produce the final figures
    213217    """
    214218    from pylab import ion, plot, xlabel, ylabel, close, legend, \
    215219         savefig, title, axis, setp, subplot, grid, figlegend, gca, \
    216          text
     220         text, sqrt
     221    import pylab
    217222   
    218223    from anuga.shallow_water.data_manager import csv2dict
    219224   
    220225    print "file_sim", file_sim
     226
     227    if False:
     228        fig_width_pt = 246.0  # Get this from LaTeX using \showthe\columnwidth
     229        inches_per_pt = 1.0/72.27               # Convert pt to inch
     230        golden_mean = (sqrt(5)-1.0)/2.0         # Aesthetic ratio
     231        fig_width = fig_width_pt*inches_per_pt  # width in inches
     232        fig_height = fig_width*golden_mean      # height in inches
     233        fig_size =  [fig_width,fig_height]
     234        print "fig_size", fig_size
     235        params = {'backend': 'ps',
     236                  'axes.labelsize': 10,
     237                  'text.fontsize': 10,
     238                  'legend.fontsize': 10,
     239                  'xtick.labelsize': 8,
     240                  'ytick.labelsize': 8,
     241                  'text.usetex': True,
     242                  'figure.figsize': [3.4, 2.1]}
     243    if False:
     244        params = {'backend': 'ps',
     245                  'axes.labelsize': 10,
     246                  'text.fontsize': 10,
     247                  'legend.fontsize': 10,
     248                  'xtick.labelsize': 8,
     249                  'ytick.labelsize': 8,
     250                  'figure.figsize': [3.4, 3.1]}
     251        pylab.rcParams.update(params)
     252
     253
     254   
    221255    # Load in the csv files and convert info from strings to floats
    222256    simulation, _ = csv2dict(file_sim)
     
    231265    for position, i in enumerate(gauge_indexs):
    232266        gauge_x = run_data['gauge_x'][i]
    233         grid_position = (len(gauge_indexs)+1)*100 + 10 + position +1
     267       
     268        grid_position = (len(gauge_indexs))*100 + 10 + position +1
    234269        subplot(grid_position)
    235270        location_sim = str(gauge_x) + y_location_tag
     
    241276   
    242277        l_sim, l_exp = plot(time_sim, quantity_sim, time_exp, quantity_exp)
    243         setp(l_sim, color='r', linestyle='--')
    244         setp(l_exp, color='b')
     278        setp(l_sim, color='k', linestyle='--')
     279        setp(l_exp, color='k')
    245280        grid(True)
    246281       
     
    282317    # The order defines the label
    283318    #legend((legend_exp, legend_sim),'upper left')
    284     figlegend((l_sim, l_exp),
    285               (legend_sim, legend_exp),
    286               'lower center')
     319
     320    # I couldn't get this working
     321    #figlegend((l_sim, l_exp),
     322     #         (legend_sim, legend_exp),
     323      #        'lower center', axespad = -0.05)
    287324   
    288325    if is_interactive:
  • anuga_work/development/Hinwood_2008/prepare_time_boundary.py

    r5459 r5681  
    1919from anuga.utilities.numerical_tools import ensure_numeric
    2020
    21 from interp import interp
     21from anuga.utilities.interp import interp
    2222
    2323
  • anuga_work/development/Hinwood_2008/run_dam.py

    r5670 r5681  
    4141import create_mesh
    4242from prepare_time_boundary import prepare_time_boundary
    43 from interp import interp
     43from anuga.utilities.interp import interp
    4444
    4545
     
    9999        finaltime = None       
    100100        maximum_triangle_area=0.01
    101         #outputdir_name += '_no_velocity'
    102101       
    103102    elif run_type == 5:
     
    136135        maximum_triangle_area=0.00001
    137136        #outputdir_name += '_good'
     137    #outputdir_name += '_no_velocity'
    138138
    139139    outputdir_name = paras2outputdir_tag(mta=maximum_triangle_area,
    140140                        yieldstep=yieldstep,
    141141                        width=width,
    142                         run_type=run_type,
    143142                        use_limits=use_limits,
    144143                        friction=friction,
     
    341340   
    342341    run_type = 1
    343     run_type = 0
     342    run_type = 0  # for testing
    344343   
    345344    #for run_data in [scenarios[5]]:
     
    351350    #width = 0.01
    352351
    353     maximum_triangle_area=0.01
     352    maximum_triangle_area=0.0001
    354353    yieldstep = 0.01
    355354    friction=0.0
  • anuga_work/development/Hinwood_2008/scenarios.py

    r5670 r5681  
    102102        'offshore_water_depth':.4,
    103103        'scenario_id':'T2R8',
    104         'gauge_names':['B','1','2','3','4','5','7'],
    105         'gauge_x':[-0.68, 1.569, 2.568, 3.566, 4.564, 5.562, 7.559],
    106         'gauge_bed_elevation':[-0.400000, -0.293158,
    107                                -0.234473, -0.175788, -0.117104,
    108                                -0.058419, 0.058950],
     104        'gauge_names':['B','1','2','3','4','5'],
     105        'gauge_x':[-0.68, 1.569, 2.568, 3.566, 4.564, 5.562],
     106        'gauge_bed_elevation':[-0.400000, -0.293158,
     107                               -0.234473, -0.175788, -0.117104,
     108                               -0.058419],
    109109        'start_slope_x':5,
    110110        'finish_slope_x':6.5,
     
    258258# These are the indexes from 'gauge_x' of the gauges for the journal article.
    259259to_publish_indexes = {'T1R5':[0, 5, 6],
    260               'T2R7':[1, 3, 5],
    261               'T3R29':[1, 6, 8],
     260              'T2R7':[0, 3, 5],
     261              'T3R29':[0, 6, 8],
    262262              'T4R32':[0, 5, 8]
    263263              }
Note: See TracChangeset for help on using the changeset viewer.