Changeset 2837


Ignore:
Timestamp:
May 8, 2006, 5:37:24 PM (19 years ago)
Author:
ole
Message:

Cosmetics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • production/onslow_2006/make_report.py

    r2834 r2837  
    1414* Report generated to scenario_report.tex where the scenario relates
    1515the name of the production directory this script is being run from.
    16 * figures used for report stored in figure directory
     16* figures used for report stored in the report_figure directory
    1717NOTE, this directory will need to be committed, as well as
    1818the latex files.
     
    4747from pyvolution.util import sww2timeseries
    4848
     49# Derive scenario name
    4950p = getcwd().split(sep)
    50 scenario = p[len(p)-1]
    51 scenario_name = scenario.split('_')[0]
     51scenario = p[-1] # Last element of absolute CWD path
     52scenario_name = scenario.split('_')[0] # Strip any text past `_`
    5253
    53 # Inputs
     54# User defined inputs
    5455report_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 Inputs
    5956
    60 gauge_filename = project.gauge_filename
    61 timedir = [timedirhigh, timedirlow]#, timedirMSL]
     57production_dirs = ['20060424_020426_duplictate_time_steps',
     58                   '20060426_004129']
     59
     60
     61# Create sections and graphs for each designated production directory
    6262latex_output = []
    63 
    64 for i in range(len(timedir)):
     63for label_id in production_dirs:
    6564   
    66     label_id = timedir[i]
    67     file_loc = project.outputdir + timedir[i] + sep
     65    file_loc = project.outputdir + label_id + sep
    6866    swwfile = file_loc + project.basename + '.sww'
    6967
    7068    texname = sww2timeseries(swwfile,
    71                              gauge_filename,
     69                             project.gauge_filename,
    7270                             file_loc,
    7371                             label_id,
     
    8078    latex_output.append(texname)
    8179
    82 # start report
     80
     81# Start report generation
    8382report_name = scenario + '_report.tex'
    8483fid = open(report_name, 'w')
    8584
    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'
     85s = """
     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"""
    102118fid.write(s)
    103119
    104 s = '\\title{%s} \n ' %report_title
     120s = '\\title{%s} \n' %report_title
    105121fid.write(s)
    106122
    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 '
     123s =
     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"""
    127152fid.write(s)
    128153
    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
     158for i, s in enumerate(['\subsection{Highest Astronomical Tide} \n',
     159                       '\subsection{Lowest Astronomical Tide} \n',
     160                       '\subsection{} \n']):
     161         
    133162    fid.write(s)
    134     #filename = latex_output[i]
    135     #s = '\input{%s} \n' %filename.replace('_','')
     163   
    136164    s = '\input{%s} \n \clearpage \n' %latex_output[i]
    137165    fid.write(s)
    138166
    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   
     169s =
     170"""\section{Summary}
     171     \input{summary}
     172     
     173   \section{References}
     174   \section{Metadata}
     175     \label{sec:metadata}
     176     \input{metadata}
     177\end{document}
     178"""
    146179fid.write(s)
Note: See TracChangeset for help on using the changeset viewer.