source: anuga_work/production/wa/mandurah_2009/get_runup.py @ 7689

Last change on this file since 7689 was 7689, checked in by osuchowski, 14 years ago

Change of parameters for modelling Mandurah

File size: 2.4 KB
RevLine 
[7545]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
[7689]19time_dir1 = '20100122_164958_run_final_0.0_27255_mosuchow'
20time_dir2 = '20100122_165026_run_final_0.6_27255_mosuchow'
21time_dir3 = '20100122_165106_run_final_0.0_27283_mosuchow'
22time_dir4 = '20100122_165125_run_final_0.6_27283_mosuchow'
23time_dir5 = '20100122_165210_run_final_0.0_68693_mosuchow'
24time_dir6 = '20100122_165236_run_final_0.6_68693_mosuchow'
25time_dir7 = '20100122_165331_run_final_0.0_68486_mosuchow'
26time_dir8 = '20100122_165725_run_final_0.6_68486_mosuchow'
[7545]27
[7689]28time_dirs = [time_dir8] #3, time_dir4, time_dir5]
[7545]29
30interior_region = []
[7689]31for region in project.interior_regions_data[2:6]:
[7545]32    polygon = read_polygon(join(project.polygons_folder,
33                                region[0]))
34    interior_region.append(polygon)
[7689]35    print region
[7545]36
[7689]37area_dictionary = {'Aoi3': interior_region[0],
38                    'Aoi4' : interior_region[1],
39                    'Area2' : interior_region[2],
40                    'Area3' : interior_region[3]}
41                   
42                   
43area = ['Aoi3', 'Aoi4', 'Area2', 'Area3'] 
[7545]44
45for time_dir in time_dirs:
46
47    basename = join(directory, time_dir, project.scenario_name)
48
49    out_file = basename+'_runup.csv'
50    output_file = open(out_file, 'w')
51    s = 'area,q,x,y\n' 
52    output_file.write(s)
53    print 'basename ',basename
54
55    for which_area in area:
56        if which_area not in area_dictionary:
57            print 'Unrecognized variable name: %s' % which_area
58            break
59
60        polygon = area_dictionary[which_area]
61       
62        print 'Which area ',which_area
63
64        q, loc = get_maximum_inundation_data(basename+'.sww',
65                                             polygon=polygon, verbose=True)
66
67        print '%s, %.6f, %.6f, %.6f\n' %(str(which_area), q, loc[0],loc[1])
68        s = '%s, %.6f, %.6f, %.6f\n' %(str(which_area), q, loc[0],loc[1])
69
70        output_file.write(s)
71
72        print 'output file printed to: %s' %out_file
73    output_file.close()
Note: See TracBrowser for help on using the repository browser.