1 | """ |
---|
2 | Generate report for production run |
---|
3 | |
---|
4 | Inputs: |
---|
5 | |
---|
6 | Report title: title to be included in tex file |
---|
7 | latex_output: list of latex_outputs which are |
---|
8 | generated for the desired output, eg high tide, |
---|
9 | low tide and MSL. |
---|
10 | |
---|
11 | |
---|
12 | Outputs: |
---|
13 | |
---|
14 | * Report generated to scenario_report.tex where the scenario relates |
---|
15 | the name of the production directory this script is being run from. |
---|
16 | * figures used for report stored in figure directory |
---|
17 | NOTE, this directory will need to be committed, as well as |
---|
18 | the latex files. |
---|
19 | |
---|
20 | The report structure is |
---|
21 | |
---|
22 | * Introduction |
---|
23 | * Data sources |
---|
24 | * Tsunami scenario |
---|
25 | * Inundation modelling results |
---|
26 | * Summary |
---|
27 | * References |
---|
28 | * Appendix: Metadata |
---|
29 | |
---|
30 | Other 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 | |
---|
42 | May 2006 |
---|
43 | """ |
---|
44 | |
---|
45 | from os import getcwd, sep |
---|
46 | import project |
---|
47 | from pyvolution.util import sww2timeseries |
---|
48 | |
---|
49 | p = getcwd().split(sep) |
---|
50 | scenario = p[len(p)-1] |
---|
51 | |
---|
52 | # Inputs |
---|
53 | report_title = 'Tsunami impact modelling for the North West shelf: %s' %scenario.title() |
---|
54 | timedirhigh = '20060424_020426_duplictate_time_steps' |
---|
55 | timedirlow = '20060426_004129' |
---|
56 | #timedirMSL = |
---|
57 | # Finish Inputs |
---|
58 | |
---|
59 | gauge_filename = project.gauge_filename |
---|
60 | timedir = [timedirhigh, timedirlow]#, timedirMSL] |
---|
61 | latex_output = [] |
---|
62 | |
---|
63 | for 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 |
---|
82 | report_name = scenario + '_report.tex' |
---|
83 | fid = open(report_name, 'w') |
---|
84 | |
---|
85 | s = '\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' |
---|
101 | fid.write(s) |
---|
102 | |
---|
103 | s = '\\title{%s} \n ' %report_title |
---|
104 | fid.write(s) |
---|
105 | |
---|
106 | s = '\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 ' |
---|
126 | fid.write(s) |
---|
127 | |
---|
128 | for i in range(len(latex_output)): |
---|
129 | s = '\input{%s} \n' %latex_output[i] |
---|
130 | fid.write(s) |
---|
131 | |
---|
132 | s = '\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}' |
---|
139 | fid.write(s) |
---|