source: anuga_work/production/hobart_2006/make_report_boundary.py @ 5212

Last change on this file since 5212 was 4580, checked in by sexton, 18 years ago

minor updates for gauge names plus plotting files

File size: 5.2 KB
RevLine 
[4580]1from os import getcwd, sep, altsep, mkdir, access, F_OK
2import project
3from anuga.abstract_2d_finite_volumes.util import sww2timeseries, get_gauges_from_file
4
5# Derive scenario name
6p = getcwd().split(sep)
7scenario = p[-1] # Last element of absolute CWD path
8scenario_name = scenario.split('_2006')[0] # Strip any text past `_2006`
9test = scenario_name.split('_')
10if len(test) <> 1:
11    scenario_name = '%s %s' %(test[0], test[1])
12   
13# Create report directory
14reportdir = getcwd()+sep+'report'+sep
15if access(reportdir,F_OK) == 0:
16    mkdir (reportdir)
17   
18#
19production_dirs = {'20061008_234702': 'Mw 8-7', # 2500 res, 750000 other res
20                   #'20061016_065743': 'Mw 8-7 refined', #new interior res
21                   '20061017_004409': 'Mw 8-7 refined', #new interior res
22                   '20061017_022640': 'Mw 8-7 paleo sites', #new interior res
23                   'MOST': 'MOST'} # MOST input for Mw 8-7
24
25#production_dirs = {'20061006_062319': 'Mw 8-5', # 2500 res, 750000 other res
26#                   'MOST': 'MOST'} # MOST input for Mw 8-5
27
28gauge_map = 'boundary_gauges.jpg'
29
30# Create sections and graphs for each designated production directory
31latex_output = []
32swwfiles = {}
33for label_id in production_dirs.keys():
34   
35    file_loc = project.outputdir + label_id + sep
36    swwfile = file_loc + project.basename + '.sww'
37    if label_id == 'MOST':
38        swwfile = project.boundarydir + project.boundary_basename + '.sww'
39    swwfiles[swwfile] = label_id
40
41texname, elev_output = sww2timeseries(swwfiles,
42                                      project.gauge_filename,
43                                      production_dirs,
44                                      report = True,
45                                      reportname = 'latexoutput_boundary',
46                                      #reportname = 'latexoutput_boundary_event2',
47                                      plot_quantity = ['stage', 'speed'],
48                                      generate_fig = True,
49                                      surface = False,
50                                      time_min = None,
51                                      time_max = None,
52                                      title_on = False,
53                                      verbose = True)
54
55latex_output.append(texname)
56
57# Start report generation
58# Future: generate_report(reportdir, scenario, report_title,
59# project.gauge_filename, max_maps, damage_maps, production_dirs, latex_output)
60report_name = reportdir + 'boundary_report.tex'
61#report_name = reportdir + 'boundary_report_event2.tex'
62fid = open(report_name, 'w')
63
64s = """
65% This is based on an automatically generated file (by make_report.py).
66%
67% Manual parts are:
68% * an abstract must be written in abstract.tex
69% * an introduction must be written in introduction.tex; a basic outline and
70%   some of the core inputs are already in place
71% * outline of the modelling methodology provided in modelling_methodology.tex
72% * the tsunami-genic event should be discussed in tsunami_scenario.tex
73% * an computational_setup.tex file needs to be written for the particular scenario
74% * the interpretation of the results needs to be written to interpretation.tex
75% * maximum inundation maps need to be included in HAT_map.tex and LAT_map.tex etc.
76% * damage modelling maps need to be included in HAT_damage and LAT_damage etc.
77% * a summary must be written into summary.tex
78% * metadata for the scenario data to be included in metadata.tex
79
80\documentclass{article}
81
82\usepackage{ae} % or {zefonts}
83\usepackage[T1]{fontenc}
84\usepackage[ansinew]{inputenc}
85\usepackage{amsmath}
86\usepackage{amssymb}
87\usepackage{graphicx}
88\usepackage{color}
89\usepackage[colorlinks]{hyperref}
90\usepackage{lscape} %landcape pages support
91\usepackage{setspace}
92\usepackage{rotating}
93\include{appendix}
94\setstretch{1.25}
95\\topmargin 0pt
96\oddsidemargin 0pt
97\evensidemargin 0pt
98\marginparwidth 0.5pt
99\\textwidth \paperwidth
100\\advance\\textwidth -2in
101
102"""
103fid.write(s)
104
105s = """
106\date{\\today}
107%\\author{Geoscience Australia}
108
109\\begin{document}
110\\title{Comparison between ANUGA and MOST}
111\maketitle
112"""
113fid.write(s)
114
115# Generate latex output for location points
116s = '\\begin{table} \\begin{center} \n'
117fid.write(s)
118s = '\caption{Defined point locations for %s study area.}' %scenario_name
119fid.write(s)
120s = """
121\label{table:locations}
122\\begin{tabular}{|l|l|l|l|}\hline
123\\bf{Point Name} & \\bf{Easting} & \\bf{Northing} & \\bf{Elevation}\\\\ \hline
124"""
125fid.write(s)
126
127gauges, locations, elevation = get_gauges_from_file(project.gauge_filename)
128
129for name, gauges, elev in zip(locations, gauges, elevation):
130    east = gauges[0]
131    north = gauges[1]
132    s = '%s & %.2f & %.2f & %.2f \\\\ \hline \n' %(name.replace('_',' '), east, north, elev)
133    fid.write(s)
134
135s = '\\end{tabular} \n  \end{center} \n \end{table} \n \n'
136fid.write(s)
137
138s = '\\begin{figure}[hbt] \n \centerline{ \includegraphics[width=\paperwidth]{../report_figures/%s}}' %gauge_map
139fid.write(s)
140
141= """
142\caption{Point locations used for boundary investigation.} 
143\label{fig:points}
144\end{figure}
145"""
146fid.write(s)
147   
148s = '\input{%s} \n \clearpage \n \n' %latex_output[0]
149fid.write(s)
150
151s="""
152\end{document}
153"""
154fid.write(s)
Note: See TracBrowser for help on using the repository browser.