source: anuga_work/production/wa/geraldton_2009/get_runup.py @ 7855

Last change on this file since 7855 was 6682, checked in by kristy, 16 years ago
File size: 2.1 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_134504_run_final_0.6_27255_Bt_kvanputt'
20time_dir2 = '20090324_140411_run_final_0.6_27283_Bt_kvanputt'
21time_dir3 = '20090324_140741_run_final_0.6_68693_Bt_kvanputt'
22time_dir4 = '20090327_155230_run_final_0_68693_Bt_kvanputt'
23time_dir5 = '20090327_160022_run_final_0_27283_Bt_kvanputt'
24time_dir6 = '20090327_160043_run_final_0_27255_Bt_kvanputt'
25
26time_dirs = [time_dir6] #, time_dir3]
27 
28interior_region = []
29for region in project.interior_regions_data[:1]:
30    polygon = read_polygon(join(project.polygons_folder,
31                                region[0]))
32    interior_region.append(polygon)
33
34area_dictionary = {'Geraldton': interior_region[0]}
35
36area = ['Geraldton'] 
37
38for time_dir in time_dirs:
39
40    basename = join(directory, time_dir, project.scenario_name)
41
42    out_file = basename+'_runup.csv'
43    output_file = open(out_file, 'w')
44    s = 'area,q,x,y\n' 
45    output_file.write(s)
46    print 'basename ',basename
47
48    for which_area in area:
49        if which_area not in area_dictionary:
50            print 'Unrecognized variable name: %s' % which_area
51            break
52
53        polygon = area_dictionary[which_area]
54       
55        print 'Which area ',which_area
56
57        q, loc = get_maximum_inundation_data(basename+'.sww',
58                                             polygon=polygon, verbose=True)
59
60        print '%s, %.6f, %.6f, %.6f\n' %(str(which_area), q, loc[0],loc[1])
61        s = '%s, %.6f, %.6f, %.6f\n' %(str(which_area), q, loc[0],loc[1])
62
63        output_file.write(s)
64
65        print 'output file printed to: %s' %out_file
66    output_file.close()
Note: See TracBrowser for help on using the repository browser.