source: production/onslow_2006/make_report.py @ 2834

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

updates

File size: 4.2 KB
Line 
1"""
2Generate report for production run
3
4Inputs:
5
6Report title:  title to be included in tex file
7latex_output:  list of latex_outputs which are
8               generated for the desired output, eg high tide,
9               low tide and MSL.
10                   
11
12Outputs:
13
14* Report generated to scenario_report.tex where the scenario relates
15the name of the production directory this script is being run from.
16* figures used for report stored in figure directory
17NOTE, this directory will need to be committed, as well as
18the latex files.
19
20The report structure is
21
22* Introduction
23* Data sources
24* Tsunami scenario
25* Inundation modelling results
26* Summary
27* References
28* Appendix: Metadata
29
30Other files included in document:
31
32* an abstract must be written in abstract.tex
33* an introduction must be written in introduction.tex; a basic outline and
34  some of the core inputs are already in place
35* an interpretation.tex file needs to be written for the particular scenario
36* any data issues must be included in data_issues.tex (data.tex should
37  be revised for future reports)
38* the tsunami-genic event should be discussed in tsunami_scenario.tex
39* a summary must be written into summary.tex
40* metadata for the scenario data to be included in metadata.tex
41
42May 2006                   
43"""
44
45from os import getcwd, sep
46import project
47from pyvolution.util import sww2timeseries
48
49p = getcwd().split(sep)
50scenario = p[len(p)-1]
51scenario_name = scenario.split('_')[0]
52
53# Inputs
54report_title = 'Tsunami impact modelling for the North West shelf: %s' %scenario_name.title()
55timedirhigh = '20060424_020426_duplictate_time_steps'
56timedirlow = '20060426_004129'
57#timedirMSL =
58# Finish Inputs
59
60gauge_filename = project.gauge_filename
61timedir = [timedirhigh, timedirlow]#, timedirMSL]
62latex_output = []
63
64for i in range(len(timedir)):
65   
66    label_id = timedir[i]
67    file_loc = project.outputdir + timedir[i] + sep
68    swwfile = file_loc + project.basename + '.sww'
69
70    texname = sww2timeseries(swwfile,
71                             gauge_filename,
72                             file_loc,
73                             label_id,
74                             plot_quantity = ['stage', 'velocity', 'bearing'],
75                             time_min = None,
76                             time_max = None,
77                             title_on = False,   
78                             verbose = True)
79
80    latex_output.append(texname)
81
82# start report
83report_name = scenario + '_report.tex'
84fid = open(report_name, 'w')
85
86s = '\documentclass{article} \n \
87\usepackage{ae} % or {zefonts} \n \
88\usepackage[T1]{fontenc} \n \
89\usepackage[ansinew]{inputenc} \n \
90\usepackage{amsmath} \n \
91\usepackage{amssymb} \n \
92\usepackage{graphicx} \n \
93\usepackage{color} \n \
94\usepackage[colorlinks]{hyperref} \n \
95\usepackage{lscape} %landcape pages support \n \
96\\topmargin 0pt \n \
97\oddsidemargin 0pt \n \
98\evensidemargin 0pt \n \
99\marginparwidth 0.5pt \n \
100\\textwidth \paperwidth \n \
101\\advance\\textwidth -2in \n'
102fid.write(s)
103
104s = '\\title{%s} \n ' %report_title
105fid.write(s)
106
107s = '\date{} \n \
108\\begin{document} \n \
109\maketitle \n \
110\\begin{abstract} \n \
111\input{abstract} \n \
112\end{abstract} \n \
113\\tableofcontents \n \
114\section{Introduction} \n \
115\label{sec:intro} \n \
116\input{introduction} \n \
117\section{Data sources} \n \
118\label{sec:data} \n \
119\input{data} \n \
120\section{Tsunami scenarios} \n \
121\label{sec:tsunami_scenarios} \n \
122\input{tsunami_scenario} \n \
123\section{Inundation modelling results} \n \
124\label{sec:results} \n \
125\input{results} \n \
126\input{interpretation} \n '
127fid.write(s)
128
129for i in range(len(latex_output)):
130    if i == 0: s = '\subsection{Highest Astronomical Tide} \n'
131    if i == 1: s = '\subsection{Lowest Astronomical Tide} \n'
132    if i == 2: s = '\subsection{} \n'
133    fid.write(s)
134    #filename = latex_output[i]
135    #s = '\input{%s} \n' %filename.replace('_','')
136    s = '\input{%s} \n \clearpage \n' %latex_output[i]
137    fid.write(s)
138
139s = '\section{Summary} \n \
140\input{summary} \n \
141\section{References} \n \
142\section{Metadata} \n \
143\label{sec:metadata} \n \
144\input{metadata} \n \
145\end{document}'
146fid.write(s)
Note: See TracBrowser for help on using the repository browser.