""" Have the script here that produces the data and graphs for the Anuga paper. Duncan Gray, GA - 2007 """ import shutil from os import path from run_dam import main, paras2outputdir_tag from calc_norm import auto_plot_test_rmsd from plot import plot_exp_sim_comparision, auto_plot_compare_csv_subfigures # # INPUT PARAMETERS # END_TAG = '_I' #END_TAG = '_Z' #END_TAG = '_I' WIDTH = 0.1 # run_type 0 is fast to test things # run_type 1 is the standard RUN_TYPE = 1 MAXIMUM_TRIANGLE_AREA=0.0001 YIELDSTEP = 0.01 FRICTION = 0.0 USE_LIMITS = False OUTPUTDIR_NAME = "" #OUTPUTDIR_NAME = "_no_velocity" def data(): """ Produce the data for the Hinwood part of the anuga paper. eg run the scenario. """ from scenarios import scenarios #scenarios = [scenarios[0]] for run_data in scenarios: pro_instance = main( run_data['scenario_id'] + '_boundary.tsm', run_data, maximum_triangle_area=MAXIMUM_TRIANGLE_AREA, yieldstep=YIELDSTEP, width=WIDTH, run_type=RUN_TYPE, outputdir_name=run_data['scenario_id'], use_limits=USE_LIMITS, friction=FRICTION, end_tag=END_TAG) def graph_RMSD(): """ Produce the graphs for the Hinwood part of the anuga paper. """ from scenarios import scenarios, to_publish_indexes # Workout where these plots are outputdir_tag = paras2outputdir_tag(mta=MAXIMUM_TRIANGLE_AREA, yieldstep=YIELDSTEP, width=WIDTH, use_limits=USE_LIMITS, friction=FRICTION, end_tag=END_TAG, outputdir_name=OUTPUTDIR_NAME) paper_dir = path.join('..','..','publications','anuga_2007') # All of the RMSD's , one per TEST file_names = auto_plot_test_rmsd(scenarios, outputdir_tag, to_publish_indexes, #add_run_info=True) add_run_info=False) # Move the files to the dir where the paper is being put together for plot_in in file_names: head, tail = path.split(plot_in) dest = path.join(paper_dir, tail) #print "plot_in", plot_in #print "dest", dest shutil.copyfile(plot_in,dest) def graph_stage_plots(): """ Produce the graphs for the Hinwood part of the anuga paper. """ from scenarios import scenarios, to_publish_indexes # Workout where these plots are outputdir_tag = paras2outputdir_tag(mta=MAXIMUM_TRIANGLE_AREA, yieldstep=YIELDSTEP, width=WIDTH, use_limits=USE_LIMITS, friction=FRICTION, end_tag=END_TAG, outputdir_name=OUTPUTDIR_NAME) paper_dir = path.join('..','..','publications','anuga_2007') # the graphs I want # stage comparison plots for T1R5, T2R7, T3R29, T4R32. plot_files = plot_exp_sim_comparision(scenarios, outputdir_tag, y_location_tag=':0.0') for key in to_publish_indexes.iterkeys(): for plot_i in to_publish_indexes[key]: plot_file_path_name = plot_files[key][plot_i] head, tail = path.split(plot_file_path_name) dest = path.join(paper_dir, tail) shutil.copyfile(plot_file_path_name,dest) def graph_4_stage_plots(): from scenarios import scenarios, to_publish_indexes #scenarios = scenarios[:2] outputdir_tag = paras2outputdir_tag(mta=MAXIMUM_TRIANGLE_AREA, yieldstep=YIELDSTEP, width=WIDTH, use_limits=USE_LIMITS, friction=FRICTION, end_tag=END_TAG, outputdir_name=OUTPUTDIR_NAME) paper_dir = path.join('..','..','publications','anuga_2007') save_as_list = auto_plot_compare_csv_subfigures(scenarios, outputdir_tag, to_publish_indexes, add_run_info=False, #add_run_info=True, is_interactive=False) for plot_in in save_as_list: head, tail = path.split(plot_in) dest = path.join(paper_dir, tail) #print "plot_in", plot_in #print "dest", dest shutil.copyfile(plot_in,dest) #------------------------------------------------------------- if __name__ == "__main__": # Edit the top of this file to change the general input parameters data() # Produce the graphs graph_RMSD() graph_4_stage_plots()