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

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

bug fixes

File size: 5.5 KB
Line 
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, auto_rrms
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   
68    # Workout where these plots are
69    outputdir_tag = paras2outputdir_tag(mta=MAXIMUM_TRIANGLE_AREA,
70                                        yieldstep=YIELDSTEP,
71                                        width=WIDTH,
72                                        use_limits=USE_LIMITS,
73                                        friction=FRICTION,
74                                        end_tag=END_TAG,
75                                        outputdir_name=OUTPUTDIR_NAME)
76    paper_dir = path.join('..','..','publications','anuga_2007')
77   
78    # Calculate the RMSD's
79    auto_rrms(outputdir_tag, scenarios, "stage", y_location_tag=':0.0')
80           
81    # All of the RMSD's , one per TEST
82   
83    file_names = auto_plot_test_rmsd(scenarios, outputdir_tag,
84                                     to_publish_indexes,
85                                     #add_run_info=True)
86                                     add_run_info=False)
87 
88    # Move the files to the dir where the paper is being put together
89    for plot_in in file_names:
90        head, tail = path.split(plot_in)
91        dest = path.join(paper_dir, tail)
92        #print "plot_in", plot_in
93        #print "dest", dest
94        shutil.copyfile(plot_in,dest)
95   
96
97   
98def graph_stage_plots():
99    """
100    Produce the graphs for the Hinwood part of the anuga paper.
101    """
102    from scenarios import scenarios, to_publish_indexes
103
104    # Workout where these plots are
105    outputdir_tag = paras2outputdir_tag(mta=MAXIMUM_TRIANGLE_AREA,
106                                        yieldstep=YIELDSTEP,
107                                        width=WIDTH,
108                                        use_limits=USE_LIMITS,
109                                        friction=FRICTION,
110                                        end_tag=END_TAG,
111                                        outputdir_name=OUTPUTDIR_NAME)
112    paper_dir = path.join('..','..','publications','anuga_2007')
113   
114    # the graphs I want
115    # stage comparison plots for T1R5, T2R7, T3R29, T4R32.
116   
117    plot_files = plot_exp_sim_comparision(scenarios, outputdir_tag,
118                             y_location_tag=':0.0')
119    for key in to_publish_indexes.iterkeys():
120        for plot_i in to_publish_indexes[key]:
121            plot_file_path_name = plot_files[key][plot_i]
122            head, tail = path.split(plot_file_path_name)
123            dest = path.join(paper_dir, tail)
124            shutil.copyfile(plot_file_path_name,dest)
125 
126def graph_4_stage_plots(): 
127    from scenarios import scenarios, to_publish_indexes
128   
129    #scenarios = scenarios[:2]
130    outputdir_tag = paras2outputdir_tag(mta=MAXIMUM_TRIANGLE_AREA,
131                                        yieldstep=YIELDSTEP,
132                                        width=WIDTH,
133                                        use_limits=USE_LIMITS,
134                                        friction=FRICTION,
135                                        end_tag=END_TAG,
136                                        outputdir_name=OUTPUTDIR_NAME)
137    paper_dir = path.join('..','..','publications','anuga_2007')         
138       
139    save_as_list = auto_plot_compare_csv_subfigures(scenarios, outputdir_tag,
140                                                    to_publish_indexes,
141                                                    add_run_info=False,
142                                                    #add_run_info=True,
143                                                    is_interactive=False)
144    for plot_in in save_as_list:
145        head, tail = path.split(plot_in)
146        dest = path.join(paper_dir, tail)
147        #print "plot_in", plot_in
148        #print "dest", dest
149        shutil.copyfile(plot_in,dest)
150
151#-------------------------------------------------------------
152if __name__ == "__main__":
153    # Edit the top of this file to change the general input parameters
154   
155    data()
156
157    # Produce the graphs
158    graph_RMSD()
159    graph_4_stage_plots()
Note: See TracBrowser for help on using the repository browser.