source: anuga_work/production/hobart_2006/make_report_boundary_BOM.py @ 3965

Last change on this file since 3965 was 3965, checked in by sexton, 17 years ago

updates (i) export to xya for Broome (ii) gauge investigation for Hobart (compare MOST and ANUGA) (iii) script to compare onslow outputs with change in parameters

File size: 5.2 KB
Line 
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                   '20061022_224422': 'Mw 8-7', #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_bom.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_bom,
43                                      production_dirs,
44                                      report = True,
45                                      reportname = 'latexoutput_boundary',
46                                      #reportname = 'latexoutput_boundary_event2',
47                                      plot_quantity = ['stage', 'speed'],
48                                      surface = False,
49                                      time_min = None,
50                                      time_max = None,
51                                      title_on = False,
52                                      verbose = True)
53
54latex_output.append(texname)
55
56# Start report generation
57# Future: generate_report(reportdir, scenario, report_title,
58# project.gauge_filename, max_maps, damage_maps, production_dirs, latex_output)
59report_name = reportdir + 'boundary_report.tex'
60#report_name = reportdir + 'boundary_report_event2.tex'
61fid = open(report_name, 'w')
62
63s = """
64% This is based on an automatically generated file (by make_report.py).
65%
66% Manual parts are:
67% * an abstract must be written in abstract.tex
68% * an introduction must be written in introduction.tex; a basic outline and
69%   some of the core inputs are already in place
70% * outline of the modelling methodology provided in modelling_methodology.tex
71% * the tsunami-genic event should be discussed in tsunami_scenario.tex
72% * an computational_setup.tex file needs to be written for the particular scenario
73% * the interpretation of the results needs to be written to interpretation.tex
74% * maximum inundation maps need to be included in HAT_map.tex and LAT_map.tex etc.
75% * damage modelling maps need to be included in HAT_damage and LAT_damage etc.
76% * a summary must be written into summary.tex
77% * metadata for the scenario data to be included in metadata.tex
78
79\documentclass{article}
80
81\usepackage{ae} % or {zefonts}
82\usepackage[T1]{fontenc}
83\usepackage[ansinew]{inputenc}
84\usepackage{amsmath}
85\usepackage{amssymb}
86\usepackage{graphicx}
87\usepackage{color}
88\usepackage[colorlinks]{hyperref}
89\usepackage{lscape} %landcape pages support
90\usepackage{setspace}
91\usepackage{rotating}
92\include{appendix}
93\setstretch{1.25}
94\\topmargin 0pt
95\oddsidemargin 0pt
96\evensidemargin 0pt
97\marginparwidth 0.5pt
98\\textwidth \paperwidth
99\\advance\\textwidth -2in
100
101"""
102fid.write(s)
103
104s = """
105\date{\\today}
106%\\author{Geoscience Australia}
107
108\\begin{document}
109\\title{Comparison between ANUGA and MOST}
110\maketitle
111"""
112fid.write(s)
113
114# Generate latex output for location points
115##s = '\\begin{table} \\begin{center} \n'
116##fid.write(s)
117##s = '\caption{Defined point locations for %s study area.}' %scenario_name
118##fid.write(s)
119##s = """
120##\label{table:locations}
121##\\begin{tabular}{|l|l|l|l|}\hline
122##\\bf{Point Name} & \\bf{Easting} & \\bf{Northing} & \\bf{Elevation}\\\\ \hline
123##"""
124##fid.write(s)
125##
126##gauges, locations, elevation = get_gauges_from_file(project.gauge_filename)
127##
128##for name, gauges, elev in zip(locations, gauges, elevation):
129##    east = gauges[0]
130##    north = gauges[1]
131##    s = '%s & %.2f & %.2f & %.2f \\\\ \hline \n' %(name.replace('_',' '), east, north, elev)
132##    fid.write(s)
133##
134##s = '\\end{tabular} \n  \end{center} \n \end{table} \n \n'
135##fid.write(s)
136
137s = '\\begin{figure}[hbt] \n \centerline{ \includegraphics[width=\paperwidth]{../report_figures/%s}}' %gauge_map
138fid.write(s)
139
140= """
141\caption{Point locations used for boundary investigation.} 
142\label{fig:points}
143\end{figure}
144"""
145fid.write(s)
146   
147s = '\input{%s} \n \clearpage \n \n' %latex_output[0]
148fid.write(s)
149
150s="""
151\end{document}
152"""
153fid.write(s)
Note: See TracBrowser for help on using the repository browser.