source: anuga_work/production/wa/mandurah_2009/export_results_max.py @ 7545

Last change on this file since 7545 was 7545, checked in by monica, 15 years ago

mandurah tsunami file setup

File size: 4.3 KB
Line 
1"""
2Generates ascii grids of nominated areas -
3Input: sww file from run_perth.py
4       boundaries for grids from project.py
5Outputs: ascii grids of specified variables
6Stored in the 'outputs_dir' folder for respective .sww file
7
8Note:
9If producing a grid for the enitre extent cellsize should be greater than 30m
10If producing grids for inundation area resolution should be greater than mesh (ie ~22m)
11"""
12
13import project, os
14import sys
15from os.path import join
16from anuga.lib.maxasc.maxasc import MaxAsc
17from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
18from anuga.shallow_water.data_manager import sww2dem
19from os import sep
20
21
22directory = project.output_folder
23
24
25time_dir1 = '20090324_134328_run_final_0.6_27255_Bt_kvanputt'
26time_dir2 = '20090324_140747_run_final_0.6_68693_Bt_kvanputt'
27time_dir3 = '20090327_152717_run_final_0.6_27283_Bt_kvanputt'
28time_dir4 = '20090327_160646_run_final_0_27255_Bt_kvanputt'
29time_dir5 = '20090327_161520_run_final_0_68693_Bt_kvanputt'
30time_dir6 = '20090330_120458_run_final_0_27283_Bt_kvanputt'
31
32time_dirs = [time_dir1] #1,time_dir2, time_dir3, time_dir4, time_dir5]
33 
34
35##cellsize = 250
36cellsize = 20
37
38#timestep = None    # None means no timestep!
39timestep = 0
40
41######
42# Set the special areas of interest.  If none, do: area='All'
43######
44
45area = ['Bunbury', 'Busselton']  # strings must match keys in var_equations below
46#area = ['All']      # 'All' means no special areas - the whole thing
47
48######
49# Define allowed variable names and associated equations to generate values.
50# This would not normally change.
51######
52var_equations = {'stage':     'stage',
53                 'momentum':  '(xmomentum**2 + ymomentum**2)**0.5',
54                 'depth':     'stage-elevation',
55                 'speed':     '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6)',
56                 'elevation': 'elevation' }
57
58# one or more key strings from var_equations above
59var = ['elevation']
60
61######
62# Start running the various conversions we require.
63######
64
65for which_var in var:
66    if which_var not in var_equations:
67        print 'Unrecognized variable name: %s' % which_var
68        break
69
70    for which_area in area:
71        if which_area == 'All':
72            easting_min = None
73            easting_max = None
74            northing_min = None
75            northing_max = None
76        else:
77            try:
78                easting_min = eval('project.xmin%s' % which_area)
79                easting_max = eval('project.xmax%s' % which_area)
80                northing_min = eval('project.ymin%s' % which_area)
81                northing_max = eval('project.ymax%s' % which_area)
82            except AttributeError:
83                print 'Unrecognized area name: %s' % which_area
84                break
85
86        for time_dir in time_dirs:
87
88            name1 = join(directory, time_dir, project.scenario_name)
89            name2 = join(directory, time_dir, project.scenario_name)+'_time_35520_0'
90            name3 = join(directory, time_dir, project.scenario_name)+'_time_71040_0'
91
92            names = [name1] #, name2, name3]
93     
94            #asc_name = []   
95               
96            for name in names:
97                         
98                outname = name + '_' + which_area + '_' + which_var
99                quantityname = var_equations[which_var]
100
101                print 'start sww2dem: time_dir=%s' % time_dir
102               
103                sww2dem(name, basename_out = outname,
104                            quantity = quantityname,
105                            timestep = timestep,
106                            cellsize = cellsize,     
107                            easting_min = easting_min,
108                            easting_max = easting_max,
109                            northing_min = northing_min,
110                            northing_max = northing_max,       
111                            reduction = max, 
112                            verbose = True,
113                            format = 'asc')
114
115##                asc_name.append(outname + '.asc')
116##   
117##            maxasc_outname = join(directory, time_dir, project.scenario_name)+'_'+which_area+'_'+which_var+'_max.asc'
118##
119##            print 'max asc outname ', maxasc_outname
120##            print 'asc_name ', str(asc_name)
121##           
122##            MaxAsc(maxasc_outname, asc_name)
Note: See TracBrowser for help on using the repository browser.