source: anuga_work/production/busselton/get_runup.py @ 6399

Last change on this file since 6399 was 6201, checked in by kristy, 15 years ago

Updating scripts

File size: 1.9 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 = '20081211_154006_run_final_0.6_27255_alpha0.1_kvanputt'
18##time_dir2 = '20081211_162311_run_final_0_27255_alpha0.1_kvanputt'
19##time_dir3 = '20081211_162346_run_final_0_68693_alpha0.1_kvanputt'
20##time_dir4 = '20081211_162433_run_final_0.6_68693_alpha0.1_kvanputt'
21##time_dir5 = '20081211_162656_run_final_0.6_27283_alpha0.1_kvanputt'
22##time_dir6 = '20081211_162744_run_final_0_27283_alpha0.1_kvanputt'
23
24time_dirs = [time_dir1] #4, time_dir5] #, time_dir3, time_dir4, time_dir5, time_dir6]
25
26area_dictionary = {'Busselton': project.poly_aoi1,
27                    'Bunbury' : project.poly_aoi2}
28
29area = ['Busselton', 'Bunbury'] 
30
31for time_dir in time_dirs:
32
33    name = directory+time_dir+sep+project.scenario_name
34
35    out_file = name+'_runup.csv'
36    output_file = open(out_file, 'w')
37    s = 'area,q,x,y\n' 
38    output_file.write(s)
39    print 'name ',name
40
41    for which_area in area:
42        if which_area not in area_dictionary:
43            print 'Unrecognized variable name: %s' % which_area
44            break
45
46        polygon = area_dictionary[which_area]
47       
48        print 'Which area ',which_area
49
50        q, loc = get_maximum_inundation_data (name+'.sww', polygon = polygon, verbose= True)
51
52        print '%s, %.6f, %.6f, %.6f\n' %(str(which_area), q, loc[0],loc[1])
53        s = '%s, %.6f, %.6f, %.6f\n' %(str(which_area), q, loc[0],loc[1])
54
55        output_file.write(s)
56
57        print 'output file printed to: %s' %out_file
58    output_file.close()
Note: See TracBrowser for help on using the repository browser.