source: anuga_work/production/onslow_2006/compare_parameter_change.py @ 4354

Last change on this file since 4354 was 4248, checked in by sexton, 18 years ago

updates

File size: 4.7 KB
Line 
1"""
2Generate latex output comparing time series of given sww files
3
4Inputs:
5
6production dirs: dictionary of output directories with a
7                 association to simulation, eg 50m boundary, 100m boundary
8
9gauge_map:       graphical output from make_gauges.py
10
11Outputs:
12
13* latex output to generate figures for report
14* figures used for report stored in the report_figure directory
15NOTE, this directory will need to be committed, as well as
16the latex files.
17
18June 2006                   
19"""
20
21from os import sep, getcwd, F_OK, access, mkdir
22import project
23from anuga.abstract_2d_finite_volumes.util import sww2timeseries, get_gauges_from_file
24
25# Derive scenario name
26p = getcwd().split(sep)
27scenario = p[-1] # Last element of absolute CWD path
28scenario_name = scenario.split('_2006')[0] # Strip any text past `_2006`
29test = scenario_name.split('_')
30if len(test) <> 1:
31    scenario_name = '%s %s' %(test[0], test[1])
32   
33# Create report directory
34reportdir = getcwd()+sep+'report'+sep
35if access(reportdir,F_OK) == 0:
36    mkdir (reportdir)
37
38# User defined inputs
39report_title = 'Parameter change comparison for ANUGA: %s' %scenario_name.title()
40   
41# User defined inputs
42production_dirs = {'20060704_063005': 'June 2006', # HAT
43                   '20061106_223150': 'Nov 2006'} # HAT
44                   #'MOST': 'MOST'}
45
46gauge_map = 'onslow_dli_gauge.jpg'
47
48# Create sections and graphs for each designated production directory
49latex_output = []
50swwfiles = {}
51for label_id in production_dirs.keys():
52   
53    file_loc = project.outputdir + label_id + sep
54    swwfile = file_loc + project.basename + '.sww'
55    if label_id == 'MOST':
56        swwfile = project.boundarydir + project.boundary_basename + '.sww'
57    swwfiles[swwfile] = label_id
58
59print 'swwfiles', swwfiles
60
61texname, vec = sww2timeseries(swwfiles,
62                              project.gauge_comparison,
63                              production_dirs,
64                              report = True,
65                              reportname = 'latexoutputparameterchange',
66                              plot_quantity = ['stage', 'speed'],
67                              generate_fig = True,
68                              surface = False,
69                              time_min = None,
70                              time_max = None,
71                              title_on = False,
72                              verbose = True)
73
74latex_output.append(texname)
75
76# Start report generation
77report_name = reportdir + scenario + '_parameter_comparison_onslow.tex'
78fid = open(report_name, 'w')
79
80s = """
81% This is based on an automatically generated file (by make_report.py).
82%
83% Manual parts are:
84% * an abstract must be written in abstract.tex
85% * an introduction must be written in introduction.tex; a basic outline and
86%   some of the core inputs are already in place
87% * outline of the modelling methodology provided in modelling_methodology.tex
88% * the tsunami-genic event should be discussed in tsunami_scenario.tex
89% * an computational_setup.tex file needs to be written for the particular scenario
90% * the interpretation of the results needs to be written to interpretation.tex
91% * maximum inundation maps need to be included in HAT_map.tex and LAT_map.tex etc.
92% * damage modelling maps need to be included in HAT_damage and LAT_damage etc.
93% * a summary must be written into summary.tex
94% * metadata for the scenario data to be included in metadata.tex
95
96\documentclass{article}
97
98\usepackage{ae} % or {zefonts}
99\usepackage[T1]{fontenc}
100\usepackage[ansinew]{inputenc}
101\usepackage{amsmath}
102\usepackage{amssymb}
103\usepackage{graphicx}
104\usepackage{color}
105\usepackage[colorlinks]{hyperref}
106\usepackage{lscape} %landcape pages support
107\usepackage{setspace}
108\usepackage{rotating}
109\include{appendix}
110\setstretch{1.25}
111\\topmargin 0pt
112\oddsidemargin 0pt
113\evensidemargin 0pt
114\marginparwidth 0.5pt
115\\textwidth \paperwidth
116\\advance\\textwidth -2in
117
118"""
119fid.write(s)
120
121#s = '\\title{%s} \n' %report_title
122#fid.write(s)
123
124s = """
125\date{\\today}
126%\\author{Geoscience Australia}
127
128\\begin{document}
129\\title{
130\\begin{figure}[hbt]
131  \centerline{ \includegraphics[scale=0.4]{../report_figures/GAlogo.jpg}}
132\end{figure}
133"""
134fid.write(s)
135
136fid.write(s)
137s = '%s} '%report_title
138fid.write(s)
139
140s = '\maketitle'
141fid.write(s)
142
143s = '\\begin{figure}[hbt] \n \centerline{ \includegraphics[width=150mm, height=100mm]{../report_figures/%s}}' %gauge_map
144fid.write(s)
145
146= """
147\caption{Point locations used to compare ANUGA output for Onslow region.} 
148\label{fig:comparisonpoints}
149\end{figure}
150"""
151fid.write(s)
152   
153s = '\input{%s} \n \clearpage \n \n' %latex_output[0]
154fid.write(s)
155
156s = '\end{document}'
157fid.write(s)
158
Note: See TracBrowser for help on using the repository browser.