Changeset 2837
- Timestamp:
- May 8, 2006, 5:37:24 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
production/onslow_2006/make_report.py
r2834 r2837 14 14 * Report generated to scenario_report.tex where the scenario relates 15 15 the name of the production directory this script is being run from. 16 * figures used for report stored in figure directory16 * figures used for report stored in the report_figure directory 17 17 NOTE, this directory will need to be committed, as well as 18 18 the latex files. … … 47 47 from pyvolution.util import sww2timeseries 48 48 49 # Derive scenario name 49 50 p = getcwd().split(sep) 50 scenario = p[ len(p)-1]51 scenario_name = scenario.split('_')[0] 51 scenario = p[-1] # Last element of absolute CWD path 52 scenario_name = scenario.split('_')[0] # Strip any text past `_` 52 53 53 # Inputs54 # User defined inputs 54 55 report_title = 'Tsunami impact modelling for the North West shelf: %s' %scenario_name.title() 55 timedirhigh = '20060424_020426_duplictate_time_steps'56 timedirlow = '20060426_004129'57 #timedirMSL =58 # Finish Inputs59 56 60 gauge_filename = project.gauge_filename 61 timedir = [timedirhigh, timedirlow]#, timedirMSL] 57 production_dirs = ['20060424_020426_duplictate_time_steps', 58 '20060426_004129'] 59 60 61 # Create sections and graphs for each designated production directory 62 62 latex_output = [] 63 64 for i in range(len(timedir)): 63 for label_id in production_dirs: 65 64 66 label_id = timedir[i] 67 file_loc = project.outputdir + timedir[i] + sep 65 file_loc = project.outputdir + label_id + sep 68 66 swwfile = file_loc + project.basename + '.sww' 69 67 70 68 texname = sww2timeseries(swwfile, 71 gauge_filename,69 project.gauge_filename, 72 70 file_loc, 73 71 label_id, … … 80 78 latex_output.append(texname) 81 79 82 # start report 80 81 # Start report generation 83 82 report_name = scenario + '_report.tex' 84 83 fid = open(report_name, 'w') 85 84 86 s = '\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' 85 s = """ 86 % This is based on an automatically generated file (by make_report.py). 87 % 88 % Manual parts are: 89 % * an abstract must be written in abstract.tex 90 % * an introduction must be written in introduction.tex; a basic outline and 91 % some of the core inputs are already in place 92 % * an interpretation.tex file needs to be written for the particular scenario 93 % * any data issues must be included in data_issues.tex (data.tex should 94 % be revised for future reports) 95 % * the tsunami-genic event should be discussed in tsunami_scenario.tex 96 % * a summary must be written into summary.tex 97 % * metadata for the scenario data to be included in metadata.tex 98 99 \documentclass{article} 100 101 \usepackage{ae} % or {zefonts} 102 \usepackage[T1]{fontenc} 103 \usepackage[ansinew]{inputenc} 104 \usepackage{amsmath} 105 \usepackage{amssymb} 106 \usepackage{graphicx} 107 \usepackage{color} 108 \usepackage[colorlinks]{hyperref} 109 \usepackage{lscape} %landcape pages support 110 111 \\topmargin 0pt 112 \oddsidemargin 0pt 113 \evensidemargin 0pt 114 \marginparwidth 0.5pt 115 \\textwidth \paperwidth 116 \\advance\\textwidth -2in 117 """ 102 118 fid.write(s) 103 119 104 s = '\\title{%s} \n 120 s = '\\title{%s} \n' %report_title 105 121 fid.write(s) 106 122 107 s = '\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 ' 123 s = 124 """ 125 \date{\today} 126 \\begin{document} 127 \maketitle 128 129 \\begin{abstract} 130 \input{abstract} 131 \end{abstract} 132 133 \\tableofcontents 134 135 \section{Introduction} 136 \label{sec:intro} 137 \input{introduction} 138 139 \section{Data sources} 140 \label{sec:data} 141 \input{data} 142 143 \section{Tsunami scenarios} 144 \label{sec:tsunami_scenarios} 145 \input{tsunami_scenario} 146 147 \section{Inundation modelling results} 148 \label{sec:results} 149 \input{results} 150 \input{interpretation} 151 """ 127 152 fid.write(s) 128 153 129 for 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' 154 155 156 # Assign titles to each production section 157 # Must specify one name per section 158 for i, s in enumerate(['\subsection{Highest Astronomical Tide} \n', 159 '\subsection{Lowest Astronomical Tide} \n', 160 '\subsection{} \n']): 161 133 162 fid.write(s) 134 #filename = latex_output[i] 135 #s = '\input{%s} \n' %filename.replace('_','') 163 136 164 s = '\input{%s} \n \clearpage \n' %latex_output[i] 137 165 fid.write(s) 138 166 139 s = '\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}' 167 168 # Closing 169 s = 170 """\section{Summary} 171 \input{summary} 172 173 \section{References} 174 \section{Metadata} 175 \label{sec:metadata} 176 \input{metadata} 177 \end{document} 178 """ 146 179 fid.write(s)
Note: See TracChangeset
for help on using the changeset viewer.