Changeset 5410


Ignore:
Timestamp:
Jun 20, 2008, 3:50:27 PM (16 years ago)
Author:
duncan
Message:

Current Hinwood scenario

Location:
anuga_work/development/Hinwood_2008
Files:
3 edited

Legend:

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

    r5399 r5410  
    11
    2 def plot_compare_csv(location_sim, file_sim, location_exp, file_exp, y_label,
     2"""
     3Plot up files from the Hinwood project.
     4"""
     5from os import sep
     6import project
     7
     8def plot_compare_csv(location_sim, file_sim, location_exp, file_exp,
     9                     y_label,
    310                     save_as=None,
     11                     plot_title="",
    412                     x_label='Time (s)',
    513                     legend_sim='ANUGA simulation',
     
    917    """
    1018    from pylab import ion, plot, xlabel, ylabel, close, legend, \
    11          savefig
     19         savefig, title
    1220    from anuga.shallow_water.data_manager import csv2dict
    1321
     
    1725    simulation, _ = csv2dict(file_sim)
    1826    experiment, _ = csv2dict(file_exp)
    19     time_sim = [float(x) for x in simulation['Time']]
     27    time_sim = [float(x) for x in simulation['time']]
    2028    quantity_sim = [float(x) for x in simulation[location_sim]]
    2129    #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']]
    2331    quantity_exp = [float(x) for x in experiment[location_exp]]
    2432
     
    3139    xlabel(x_label)
    3240    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)
    3445   
    3546    if is_interactive:
     
    4354    close()
    4455   
    45 
     56def 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
    4678
    4779#-------------------------------------------------------------
     
    4981    """ Plot the stage graph for the ANUGA validation papar
    5082    """
     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)
    51108
    52     import project
    53     import shutil
    54     from os import sep, path
    55 
    56 
    57      # T1R5
    58     run_data = {'xleft':[-3.106,0.0],  # Av' of ADV and Gauge A
    59                      '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_exp
    81     file_sim = pro_instance.raw_data_dir + sep + id + 'pressfilt_exp_depth.csv'
    82     print "file_sim", file_sim
    83     location_sim = str(run_data['gauge_x'][0])
    84     location_exp =  str(run_data['gauge_x'][0]) + ':0.225'
    85     # create Depth plot
    86     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  
    4040        self.boundarydir = self.outputdir
    4141        self.raw_data_dir = join(scenariodir, 'raw_data')
     42        self.plots_dir = join(scenariodir, 'plots')
    4243
    4344        # creates copy of output dir structure, if it doesn't exist
     
    4849        if not access(self.outputdir,F_OK):
    4950            mkdir (self.outputdir)
     51        if not access(self.plots_dir,F_OK):
     52            mkdir (self.plots_dir)
    5053
    5154        self.codedir = getcwd()+sep
  • anuga_work/development/Hinwood_2008/run_dam.py

    r5405 r5410  
    8383        maximum_triangle_area=0.001
    8484    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:
    8593        outputdir_name += '_good_tri_area_0.001_A'
    8694        # this is not a test
     
    9098        finaltime = None       
    9199        maximum_triangle_area=0.001
    92     elif run_type == 5:
     100    elif run_type == 6:
    93101        outputdir_name += '_good_tri_area_0.0001_A'
    94102        # this is not a test
     
    98106        finaltime = None       
    99107        maximum_triangle_area=0.0001
    100     elif run_type == 6:
    101         outputdir_name += '_good_tri_area_0.01_A'
    102         # this is not a test
    103         # Output will go to a file
    104         # The sww file will be interpolated
    105         yieldstep = 0.01
    106         finaltime = None       
    107         maximum_triangle_area=0.01
    108108     
    109109    metadata_dic = set_z_origin_to_water_depth(metadata_dic)   
     
    125125    if finaltime is None:
    126126        finaltime = boundary_final_time
    127    
    128127    # Boundary file manipulation
    129128    if boundary_path is None:
     
    276275
    277276    # 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                     }
    279293    main( run_data['scenario_id'] + '_boundary.tsm'  , run_data,
    280294          run_type = run_type,
Note: See TracChangeset for help on using the changeset viewer.