Index: /production/onslow_2006/make_report.py
===================================================================
--- /production/onslow_2006/make_report.py	(revision 2836)
+++ /production/onslow_2006/make_report.py	(revision 2837)
@@ -14,5 +14,5 @@
 * Report generated to scenario_report.tex where the scenario relates
 the name of the production directory this script is being run from.
-* figures used for report stored in figure directory
+* figures used for report stored in the report_figure directory
 NOTE, this directory will need to be committed, as well as
 the latex files.
@@ -47,27 +47,25 @@
 from pyvolution.util import sww2timeseries
 
+# Derive scenario name
 p = getcwd().split(sep)
-scenario = p[len(p)-1]
-scenario_name = scenario.split('_')[0]
+scenario = p[-1] # Last element of absolute CWD path
+scenario_name = scenario.split('_')[0] # Strip any text past `_`
 
-# Inputs
+# User defined inputs
 report_title = 'Tsunami impact modelling for the North West shelf: %s' %scenario_name.title()
-timedirhigh = '20060424_020426_duplictate_time_steps'
-timedirlow = '20060426_004129'
-#timedirMSL =
-# Finish Inputs
 
-gauge_filename = project.gauge_filename
-timedir = [timedirhigh, timedirlow]#, timedirMSL]
+production_dirs = ['20060424_020426_duplictate_time_steps',
+                   '20060426_004129']
+
+
+# Create sections and graphs for each designated production directory
 latex_output = []
-
-for i in range(len(timedir)):
+for label_id in production_dirs:
     
-    label_id = timedir[i]
-    file_loc = project.outputdir + timedir[i] + sep
+    file_loc = project.outputdir + label_id + sep
     swwfile = file_loc + project.basename + '.sww'
 
     texname = sww2timeseries(swwfile,
-                             gauge_filename,
+                             project.gauge_filename,
                              file_loc,
                              label_id,
@@ -80,67 +78,102 @@
     latex_output.append(texname)
 
-# start report
+
+# Start report generation
 report_name = scenario + '_report.tex'
 fid = open(report_name, 'w')
 
-s = '\documentclass{article} \n \
-\usepackage{ae} % or {zefonts} \n \
-\usepackage[T1]{fontenc} \n \
-\usepackage[ansinew]{inputenc} \n \
-\usepackage{amsmath} \n \
-\usepackage{amssymb} \n \
-\usepackage{graphicx} \n \
-\usepackage{color} \n \
-\usepackage[colorlinks]{hyperref} \n \
-\usepackage{lscape} %landcape pages support \n \
-\\topmargin 0pt \n \
-\oddsidemargin 0pt \n \
-\evensidemargin 0pt \n \
-\marginparwidth 0.5pt \n \
-\\textwidth \paperwidth \n \
-\\advance\\textwidth -2in \n'
+s = """
+% This is based on an automatically generated file (by make_report.py).
+%
+% Manual parts are:
+% * an abstract must be written in abstract.tex
+% * an introduction must be written in introduction.tex; a basic outline and
+%   some of the core inputs are already in place
+% * an interpretation.tex file needs to be written for the particular scenario
+% * any data issues must be included in data_issues.tex (data.tex should
+%   be revised for future reports)
+% * the tsunami-genic event should be discussed in tsunami_scenario.tex
+% * a summary must be written into summary.tex
+% * metadata for the scenario data to be included in metadata.tex
+
+\documentclass{article}
+
+\usepackage{ae} % or {zefonts}
+\usepackage[T1]{fontenc}
+\usepackage[ansinew]{inputenc}
+\usepackage{amsmath}
+\usepackage{amssymb}
+\usepackage{graphicx}
+\usepackage{color}
+\usepackage[colorlinks]{hyperref}
+\usepackage{lscape} %landcape pages support
+
+\\topmargin 0pt
+\oddsidemargin 0pt
+\evensidemargin 0pt
+\marginparwidth 0.5pt
+\\textwidth \paperwidth
+\\advance\\textwidth -2in
+"""
 fid.write(s)
 
-s = '\\title{%s} \n ' %report_title
+s = '\\title{%s} \n' %report_title
 fid.write(s)
 
-s = '\date{} \n \
-\\begin{document} \n \
-\maketitle \n \
-\\begin{abstract} \n \
-\input{abstract} \n \
-\end{abstract} \n \
-\\tableofcontents \n \
-\section{Introduction} \n \
-\label{sec:intro} \n \
-\input{introduction} \n \
-\section{Data sources} \n \
-\label{sec:data} \n \
-\input{data} \n \
-\section{Tsunami scenarios} \n \
-\label{sec:tsunami_scenarios} \n \
-\input{tsunami_scenario} \n \
-\section{Inundation modelling results} \n \
-\label{sec:results} \n \
-\input{results} \n \
-\input{interpretation} \n '
+s =
+"""
+\date{\today}
+\\begin{document}
+  \maketitle
+  
+  \\begin{abstract}
+    \input{abstract}
+  \end{abstract}
+  
+  \\tableofcontents
+  
+  \section{Introduction}
+    \label{sec:intro}
+  \input{introduction}
+  
+  \section{Data sources}
+    \label{sec:data}
+    \input{data}
+    
+  \section{Tsunami scenarios}
+    \label{sec:tsunami_scenarios}
+    \input{tsunami_scenario}
+    
+  \section{Inundation modelling results}
+     \label{sec:results}
+     \input{results}
+     \input{interpretation}
+"""
 fid.write(s)
 
-for i in range(len(latex_output)):
-    if i == 0: s = '\subsection{Highest Astronomical Tide} \n'
-    if i == 1: s = '\subsection{Lowest Astronomical Tide} \n'
-    if i == 2: s = '\subsection{} \n'
+
+
+# Assign titles to each production section
+# Must specify one name per section
+for i, s in enumerate(['\subsection{Highest Astronomical Tide} \n',
+                       '\subsection{Lowest Astronomical Tide} \n',
+                       '\subsection{} \n']):
+          
     fid.write(s)
-    #filename = latex_output[i]
-    #s = '\input{%s} \n' %filename.replace('_','')
+    
     s = '\input{%s} \n \clearpage \n' %latex_output[i]
     fid.write(s)
 
-s = '\section{Summary} \n \
-\input{summary} \n \
-\section{References} \n \
-\section{Metadata} \n \
-\label{sec:metadata} \n \
-\input{metadata} \n \
-\end{document}'
+
+# Closing    
+s =
+"""\section{Summary}
+     \input{summary}
+     
+   \section{References}
+   \section{Metadata}
+     \label{sec:metadata}
+     \input{metadata}
+\end{document}
+"""
 fid.write(s)
