source: production/onslow_2006/make_report.py @ 2815

Last change on this file since 2815 was 2815, checked in by sexton, 19 years ago

moving files within production directory; scripts for report making and timeseries

File size: 3.8 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]
51
52# Inputs
53report_title = 'Tsunami impact modelling for the North West shelf: %s' %scenario.title()
54timedirhigh = '20060424_020426_duplictate_time_steps'
55timedirlow = '20060426_004129'
56#timedirMSL =
57# Finish Inputs
58
59gauge_filename = project.gauge_filename
60timedir = [timedirhigh, timedirlow]#, timedirMSL]
61latex_output = []
62
63for i in range(len(timedir)):
64   
65    label_id = timedir[i]
66    file_loc = project.outputdir + timedir[i] + sep
67    swwfile = file_loc + project.basename + '.sww'
68
69    texname = sww2timeseries(swwfile,
70                             gauge_filename,
71                             file_loc,
72                             label_id,
73                             plot_quantity = ['stage', 'velocity', 'bearing'],
74                             time_min = None,
75                             time_max = None,
76                             title_on = False,   
77                             verbose = True)
78
79    latex_output.append(texname)
80
81# start report
82report_name = scenario + '_report.tex'
83fid = open(report_name, 'w')
84
85s = '\documentclass{article} \n \
86\usepackage{ae} % or {zefonts} \n \
87\usepackage[T1]{fontenc} \n \
88\usepackage[ansinew]{inputenc} \n \
89\usepackage{amsmath} \n \
90\usepackage{amssymb} \n \
91\usepackage{graphicx} \n \
92\usepackage{color} \n \
93\usepackage[colorlinks]{hyperref} \n \
94\usepackage{lscape} %landcape pages support \n \
95\\topmargin 0pt \n \
96\oddsidemargin 0pt \n \
97\evensidemargin 0pt \n \
98\marginparwidth 0.5pt \n \
99\\textwidth \paperwidth \n \
100\\advance\\textwidth -2in \n'
101fid.write(s)
102
103s = '\\title{%s} \n ' %report_title
104fid.write(s)
105
106s = '\date{} \n \
107\\begin{document} \n \
108\maketitle \n \
109\\begin{abstract} \n \
110\input{abstract} \n \
111\end{abstract} \n \
112\\tableofcontents \n \
113\section{Introduction} \n \
114\label{sec:intro} \n \
115\input{introduction} \n \
116\section{Data sources} \n \
117\label{sec:data} \n \
118\input{data} \n \
119\section{Tsunami scenarios} \n \
120\label{sec:tsunami_scenarios} \n \
121\input{tsunami_scenario} \n \
122\section{Inundation modelling results} \n \
123\label{sec:results} \n \
124\input{results} \n \
125\input{interpretation} \n '
126fid.write(s)
127
128for i in range(len(latex_output)):
129    s = '\input{%s} \n' %latex_output[i]
130    fid.write(s)
131
132s = '\section{Summary} \n \
133\input{summary} \n \
134\section{References} \n \
135\section{Metadata} \n \
136\label{sec:metadata} \n \
137\input{metadata.tex} \n \
138\end{document}'
139fid.write(s)
Note: See TracBrowser for help on using the repository browser.