source: anuga_work/production/perth/perth_rerun/get_runup.py @ 7254

Last change on this file since 7254 was 7113, checked in by kristy, 15 years ago
File size: 2.3 KB
Line 
1# Standard modules
2from os import sep
3import os
4from os.path import dirname, basename
5from os import mkdir, access, F_OK
6from os.path import join
7from anuga.utilities.polygon import read_polygon
8from shutil import copy
9import time
10import sys
11# Related major packages
12from anuga.shallow_water.data_manager import get_maximum_inundation_data
13       
14# Application specific imports
15from setup_model import project  # Definition of file names and polygons
16import csv
17directory = project.output_folder
18
19time_dir1 = '20090324_135427_run_final_0.6_27255_Bt_kvanputt'
20time_dir2 = '20090324_154957_run_final_0.6_68693_Bt_kvanputt'
21time_dir3 = '20090324_155028_run_final_0.6_27283_Bt_kvanputt'
22time_dir4 = '20090327_155353_run_final_0_27283_Bt_kvanputt'
23time_dir5 = '20090327_155659_run_final_0_27255_Bt_kvanputt'
24time_dir6 = '20090327_155803_run_final_0_68693_Bt_kvanputt'
25
26time_dirs = [time_dir4, time_dir5, time_dir6] #[time_dir1, time_dir2, time_dir3] #,
27
28interior_region = []
29for region in project.interior_regions_data[:5]:
30    polygon = read_polygon(join(project.polygons_folder,
31                                region[0]))
32    interior_region.append(polygon)
33
34area_dictionary = {'Fremantle' : interior_region[0],
35                  'Rockingham' : interior_region[1],
36                     'Geordie' : interior_region[3],
37                    'Sorrento' : interior_region[4]}
38
39area = ['Fremantle', 'Rockingham', 'Geordie', 'Sorrento'] 
40
41for time_dir in time_dirs:
42
43    basename = join(directory, time_dir, project.scenario_name)
44
45    out_file = basename+'_runup.csv'
46    output_file = open(out_file, 'w')
47    s = 'area,q,x,y\n' 
48    output_file.write(s)
49    print 'basename ',basename
50
51    for which_area in area:
52        if which_area not in area_dictionary:
53            print 'Unrecognized variable name: %s' % which_area
54            break
55
56        polygon = area_dictionary[which_area]
57       
58        print 'Which area ',which_area
59
60        q, loc = get_maximum_inundation_data(basename+'.sww',
61                                             polygon=polygon, verbose=True)
62
63        print '%s, %.6f, %.6f, %.6f\n' %(str(which_area), q, loc[0],loc[1])
64        s = '%s, %.6f, %.6f, %.6f\n' %(str(which_area), q, loc[0],loc[1])
65
66        output_file.write(s)
67
68        print 'output file printed to: %s' %out_file
69    output_file.close()
Note: See TracBrowser for help on using the repository browser.