source: anuga_work/development/Hinwood_2008/validation_graphs.py @ 5699

Last change on this file since 5699 was 5699, checked in by duncan, 16 years ago

add file to make graphs for anuga paper

File size: 5.4 KB
RevLine 
[5699]1"""
2
3Have the script here that produces the data and graphs for the Anuga paper.
4
5
6Duncan Gray, GA - 2007
7
8
9
10"""
11
12import shutil
13from os import path
14
15from run_dam import main, paras2outputdir_tag
16from calc_norm import auto_plot_test_rmsd
17from plot import plot_exp_sim_comparision, auto_plot_compare_csv_subfigures
18
19#
20# INPUT PARAMETERS
21#
22
23END_TAG = '_I'
24#END_TAG = '_Z'
25#END_TAG = '_I'
26
27WIDTH = 0.1
28
29# run_type 0 is fast to test things
30# run_type 1 is the standard
31RUN_TYPE = 1
32MAXIMUM_TRIANGLE_AREA=0.0001
33YIELDSTEP = 0.01
34FRICTION = 0.0
35USE_LIMITS = False
36OUTPUTDIR_NAME = ""
37#OUTPUTDIR_NAME = "_no_velocity"
38   
39def data():
40    """
41    Produce the data for the Hinwood part of the anuga paper.
42    eg run the scenario.
43    """
44    from scenarios import scenarios
45
46
47    #scenarios = [scenarios[0]]
48    for run_data in scenarios:
49        pro_instance = main( run_data['scenario_id'] + '_boundary.tsm',
50                             run_data,
51                             maximum_triangle_area=MAXIMUM_TRIANGLE_AREA,
52                             yieldstep=YIELDSTEP,
53                             width=WIDTH,
54                             run_type=RUN_TYPE,
55                             outputdir_name=run_data['scenario_id'],
56                             use_limits=USE_LIMITS,
57                             friction=FRICTION,
58                             end_tag=END_TAG)
59
60   
61def graph_RMSD():
62    """
63    Produce the graphs for the Hinwood part of the anuga paper.
64    """
65    from scenarios import scenarios, to_publish_indexes
66
67    # Workout where these plots are
68    outputdir_tag = paras2outputdir_tag(mta=MAXIMUM_TRIANGLE_AREA,
69                                        yieldstep=YIELDSTEP,
70                                        width=WIDTH,
71                                        use_limits=USE_LIMITS,
72                                        friction=FRICTION,
73                                        end_tag=END_TAG,
74                                        outputdir_name=OUTPUTDIR_NAME)
75    paper_dir = path.join('..','..','publications','anuga_2007')
76   
77           
78    # All of the RMSD's , one per TEST
79   
80    file_names = auto_plot_test_rmsd(scenarios, outputdir_tag,
81                                     to_publish_indexes,
82                                     #add_run_info=True)
83                                     add_run_info=False)
84 
85    # Move the files to the dir where the paper is being put together
86    for plot_in in file_names:
87        head, tail = path.split(plot_in)
88        dest = path.join(paper_dir, tail)
89        #print "plot_in", plot_in
90        #print "dest", dest
91        shutil.copyfile(plot_in,dest)
92   
93
94   
95def graph_stage_plots():
96    """
97    Produce the graphs for the Hinwood part of the anuga paper.
98    """
99    from scenarios import scenarios, to_publish_indexes
100
101    # Workout where these plots are
102    outputdir_tag = paras2outputdir_tag(mta=MAXIMUM_TRIANGLE_AREA,
103                                        yieldstep=YIELDSTEP,
104                                        width=WIDTH,
105                                        use_limits=USE_LIMITS,
106                                        friction=FRICTION,
107                                        end_tag=END_TAG,
108                                        outputdir_name=OUTPUTDIR_NAME)
109    paper_dir = path.join('..','..','publications','anuga_2007')
110   
111    # the graphs I want
112    # stage comparison plots for T1R5, T2R7, T3R29, T4R32.
113   
114    plot_files = plot_exp_sim_comparision(scenarios, outputdir_tag,
115                             y_location_tag=':0.0')
116    for key in to_publish_indexes.iterkeys():
117        for plot_i in to_publish_indexes[key]:
118            plot_file_path_name = plot_files[key][plot_i]
119            head, tail = path.split(plot_file_path_name)
120            dest = path.join(paper_dir, tail)
121            shutil.copyfile(plot_file_path_name,dest)
122 
123def graph_4_stage_plots(): 
124    from scenarios import scenarios, to_publish_indexes
125   
126    #scenarios = scenarios[:2]
127    outputdir_tag = paras2outputdir_tag(mta=MAXIMUM_TRIANGLE_AREA,
128                                        yieldstep=YIELDSTEP,
129                                        width=WIDTH,
130                                        use_limits=USE_LIMITS,
131                                        friction=FRICTION,
132                                        end_tag=END_TAG,
133                                        outputdir_name=OUTPUTDIR_NAME)
134    paper_dir = path.join('..','..','publications','anuga_2007')         
135       
136    save_as_list = auto_plot_compare_csv_subfigures(scenarios, outputdir_tag,
137                                                    to_publish_indexes,
138                                                    add_run_info=False,
139                                                    #add_run_info=True,
140                                                    is_interactive=False)
141    for plot_in in save_as_list:
142        head, tail = path.split(plot_in)
143        dest = path.join(paper_dir, tail)
144        #print "plot_in", plot_in
145        #print "dest", dest
146        shutil.copyfile(plot_in,dest)
147
148#-------------------------------------------------------------
149if __name__ == "__main__":
150    # Edit the top of this file to change the general input parameters
151   
152    #data()
153
154    # Produce the graphs
155    graph_RMSD()
156    graph_4_stage_plots()
Note: See TracBrowser for help on using the repository browser.