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

Last change on this file since 4058 was 3965, checked in by sexton, 18 years ago

updates (i) export to xya for Broome (ii) gauge investigation for Hobart (compare MOST and ANUGA) (iii) script to compare onslow outputs with change in parameters

File size: 4.6 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                              surface = False,
68                              time_min = None,
69                              time_max = None,
70                              title_on = False,
71                              verbose = True)
72
73latex_output.append(texname)
74
75# Start report generation
76report_name = reportdir + scenario + '_parameter_comparison_onslow.tex'
77fid = open(report_name, 'w')
78
79s = """
80% This is based on an automatically generated file (by make_report.py).
81%
82% Manual parts are:
83% * an abstract must be written in abstract.tex
84% * an introduction must be written in introduction.tex; a basic outline and
85%   some of the core inputs are already in place
86% * outline of the modelling methodology provided in modelling_methodology.tex
87% * the tsunami-genic event should be discussed in tsunami_scenario.tex
88% * an computational_setup.tex file needs to be written for the particular scenario
89% * the interpretation of the results needs to be written to interpretation.tex
90% * maximum inundation maps need to be included in HAT_map.tex and LAT_map.tex etc.
91% * damage modelling maps need to be included in HAT_damage and LAT_damage etc.
92% * a summary must be written into summary.tex
93% * metadata for the scenario data to be included in metadata.tex
94
95\documentclass{article}
96
97\usepackage{ae} % or {zefonts}
98\usepackage[T1]{fontenc}
99\usepackage[ansinew]{inputenc}
100\usepackage{amsmath}
101\usepackage{amssymb}
102\usepackage{graphicx}
103\usepackage{color}
104\usepackage[colorlinks]{hyperref}
105\usepackage{lscape} %landcape pages support
106\usepackage{setspace}
107\usepackage{rotating}
108\include{appendix}
109\setstretch{1.25}
110\\topmargin 0pt
111\oddsidemargin 0pt
112\evensidemargin 0pt
113\marginparwidth 0.5pt
114\\textwidth \paperwidth
115\\advance\\textwidth -2in
116
117"""
118fid.write(s)
119
120#s = '\\title{%s} \n' %report_title
121#fid.write(s)
122
123s = """
124\date{\\today}
125%\\author{Geoscience Australia}
126
127\\begin{document}
128\\title{
129\\begin{figure}[hbt]
130  \centerline{ \includegraphics[scale=0.4]{../report_figures/GAlogo.jpg}}
131\end{figure}
132"""
133fid.write(s)
134
135fid.write(s)
136s = '%s} '%report_title
137fid.write(s)
138
139s = '\maketitle'
140fid.write(s)
141
142s = '\\begin{figure}[hbt] \n \centerline{ \includegraphics[width=150mm, height=100mm]{../report_figures/%s}}' %gauge_map
143fid.write(s)
144
145= """
146\caption{Point locations used to compare ANUGA output for Onslow region.} 
147\label{fig:comparisonpoints}
148\end{figure}
149"""
150fid.write(s)
151   
152s = '\input{%s} \n \clearpage \n \n' %latex_output[0]
153fid.write(s)
154
155s = '\end{document}'
156fid.write(s)
157
Note: See TracBrowser for help on using the repository browser.