[6068] | 1 | # Standard modules |
---|
| 2 | from os import sep |
---|
| 3 | import os |
---|
| 4 | from os.path import dirname, basename |
---|
| 5 | from os import mkdir, access, F_OK |
---|
| 6 | from shutil import copy |
---|
| 7 | import time |
---|
| 8 | import sys |
---|
| 9 | # Related major packages |
---|
| 10 | from anuga.shallow_water.data_manager import get_maximum_inundation_data |
---|
| 11 | |
---|
| 12 | # Application specific imports |
---|
| 13 | import project # Definition of file names and polygons |
---|
| 14 | import csv |
---|
| 15 | directory = project.output_dir |
---|
| 16 | |
---|
| 17 | time_dir1 = '20081202_084220_run_final_1_27283_alpha0.1_kvanputt' |
---|
| 18 | time_dir2 = '20081202_084202_run_final_1_27255_alpha0.1_kvanputt' |
---|
| 19 | time_dir3 = '20081202_084132_run_final_1_68693_alpha0.1_kvanputt' |
---|
| 20 | time_dir4 = '20081202_084025_run_final_0_68693_alpha0.1_kvanputt' |
---|
| 21 | time_dir5 = '20081202_083932_run_final_0_27255_alpha0.1_kvanputt' |
---|
| 22 | time_dir6 = '20081201_103449_run_final_0_27283_alpha0.1_kvanputt' |
---|
| 23 | |
---|
| 24 | time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6] |
---|
| 25 | |
---|
| 26 | area_dictionary = {'CBD': project.poly_aoi1} |
---|
| 27 | |
---|
| 28 | area = ['CBD'] |
---|
| 29 | |
---|
| 30 | for time_dir in time_dirs: |
---|
| 31 | |
---|
| 32 | name = directory+time_dir+sep+project.scenario_name |
---|
| 33 | |
---|
| 34 | out_file = name+'_runup.csv' |
---|
| 35 | output_file = open(out_file, 'w') |
---|
| 36 | s = 'area,q,x,y\n' |
---|
| 37 | output_file.write(s) |
---|
| 38 | print 'name ',name |
---|
| 39 | |
---|
| 40 | for which_area in area: |
---|
| 41 | if which_area not in area_dictionary: |
---|
| 42 | print 'Unrecognized variable name: %s' % which_area |
---|
| 43 | break |
---|
| 44 | |
---|
| 45 | polygon = area_dictionary[which_area] |
---|
| 46 | |
---|
| 47 | print 'Which area ',which_area |
---|
| 48 | |
---|
| 49 | q, loc = get_maximum_inundation_data (name+'.sww', polygon = polygon, verbose= True) |
---|
| 50 | |
---|
| 51 | print '%s, %.6f, %.6f, %.6f\n' %(str(which_area), q, loc[0],loc[1]) |
---|
| 52 | s = '%s, %.6f, %.6f, %.6f\n' %(str(which_area), q, loc[0],loc[1]) |
---|
| 53 | |
---|
| 54 | output_file.write(s) |
---|
| 55 | |
---|
| 56 | print 'output file printed to: %s' %out_file |
---|
| 57 | output_file.close() |
---|