source: anuga_work/production/perth/get_runup.py @ 6498

Last change on this file since 6498 was 6030, checked in by kristy, 16 years ago

able to get maximum runup, after the sww script has been run.

File size: 2.0 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 shutil import copy
7import time
8import sys
9# Related major packages
10from anuga.shallow_water.data_manager import get_maximum_inundation_data
11       
12# Application specific imports
13import project  # Definition of file names and polygons
14import csv
15directory = project.output_dir
16
17time_dir1 = '20081031_133353_run_final_0.6_68693_alpha0.1_kvanputt'
18time_dir2 = '20081031_133511_run_final_0_68693_alpha0.1_kvanputt'
19time_dir3 = '20081031_133624_run_final_0_27255_alpha0.1_kvanputt'
20time_dir4 = '20081031_133735_run_final_0.6_27255_alpha0.1_kvanputt'
21time_dir5 = '20081031_133841_run_final_0_27283_alpha0.1_kvanputt'
22time_dir6 = '20081031_133925_run_final_0.6_27283_alpha0.1_kvanputt'
23
24time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
25
26area_dictionary = {'Rockingham': project.poly_aoi2,
27                    'Sorrento' : project.poly_aoi4,
28                    'Fremantle': project.poly_aoi1,
29                    'Geordie'  : project.poly_aoi3}
30
31area = ['Rockingham', 'Sorrento', 'Fremantle', 'Geordie'] 
32
33for time_dir in time_dirs:
34
35    name = directory+time_dir+sep+project.scenario_name
36
37    out_file = name+'_runup.csv'
38    output_file = open(out_file, 'w')
39    s = 'area,q,x,y\n' 
40    output_file.write(s)
41    print 'name ',name
42
43    for which_area in area:
44        if which_area not in area_dictionary:
45            print 'Unrecognized variable name: %s' % which_area
46            break
47
48        polygon = area_dictionary[which_area]
49       
50        print 'Which area ',which_area
51
52        q, loc = get_maximum_inundation_data (name+'.sww', polygon = polygon, verbose= True)
53
54        print '%s, %.6f, %.6f, %.6f\n' %(str(which_area), q, loc[0],loc[1])
55        s = '%s, %.6f, %.6f, %.6f\n' %(str(which_area), q, loc[0],loc[1])
56
57        output_file.write(s)
58
59        print 'output file printed to: %s' %out_file
60    output_file.close()
Note: See TracBrowser for help on using the repository browser.