source: anuga_work/production/australia_ph2/melbourne_east/single_urs/export_results_max.py @ 7023

Last change on this file since 7023 was 7023, checked in by myall, 15 years ago

exporting results;
making new folder in melbourne_east called single_urs, for scripts to run the model with both east and west boundaries from urs

File size: 4.5 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
24time_dir1 = '20090511_145103_run_trial_0_31853_2649_Tb_both__mhingee'
25time_dir2 = ''
26time_dir3 = ''
27time_dir4 = ''
28time_dir5 = ''
29time_dir6 = ''
30
31##time_dir1 = '20090421_152359_run_final_0_58115_2649_Tb_east_internal_mhingee'
32
33##time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
34time_dirs = [time_dir1]
35
36cellsize = 250
37##cellsize = 5
38
39timestep = None    # None means no timestep!
40#timestep = 0
41
42######
43# Set the special areas of interest.  If none, do: area='All'
44######
45
46#area = ['Bunbury', 'Busselton']  # strings must match keys in var_equations below
47area = ['All']      # 'All' means no special areas - the whole thing
48
49######
50# Define allowed variable names and associated equations to generate values.
51# This would not normally change.
52######
53var_equations = {'stage':     'stage',
54                 'momentum':  '(xmomentum**2 + ymomentum**2)**0.5',
55                 'depth':     'stage-elevation',
56                 'speed':     '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6)',
57                 'elevation': 'elevation' }
58
59# one or more key strings from var_equations above
60var = ['stage']
61
62######
63# Start running the various conversions we require.
64######
65
66for which_var in var:
67    if which_var not in var_equations:
68        print 'Unrecognized variable name: %s' % which_var
69        break
70
71    for which_area in area:
72        if which_area == 'All':
73            easting_min = None
74            easting_max = None
75            northing_min = None
76            northing_max = None
77        else:
78            try:
79                easting_min = eval('project.xmin%s' % which_area)
80                easting_max = eval('project.xmax%s' % which_area)
81                northing_min = eval('project.ymin%s' % which_area)
82                northing_max = eval('project.ymax%s' % which_area)
83            except AttributeError:
84                print 'Unrecognized area name: %s' % which_area
85                break
86
87        for time_dir in time_dirs:
88
89            name1 = join(directory, time_dir, project.scenario_name)
90##            name2 = join(directory, time_dir, project.scenario_name)+'_time_10740_0'
91##            name3 = join(directory, time_dir, project.scenario_name)+'_time_21480_0'
92##            name4 = join(directory, time_dir, project.scenario_name)+'_time_32220_0'
93##            name5 = join(directory, time_dir, project.scenario_name)+'_time_42960_0'
94##            name6 = join(directory, time_dir, project.scenario_name)+'_time_53700_0'
95
96            names = [name1]#, name2, name3, name4, name5, name6]
97     
98##            asc_name = []   
99               
100            for name in names:
101                         
102                outname = name + '_' + which_area + '_' + which_var
103                quantityname = var_equations[which_var]
104
105                print 'start sww2dem: time_dir=%s' % time_dir
106               
107                sww2dem(name, basename_out = outname,
108                            quantity = quantityname,
109                            timestep = timestep,
110                            cellsize = cellsize,     
111                            easting_min = easting_min,
112                            easting_max = easting_max,
113                            northing_min = northing_min,
114                            northing_max = northing_max,       
115                            reduction = max, 
116                            verbose = True,
117                            format = 'asc')
118
119##                asc_name.append(outname + '.asc')
120##   
121##            maxasc_outname = join(directory, time_dir, project.scenario_name)+'_'+which_area+'_'+which_var+'_max.asc'
122##
123##            print 'max asc outname ', maxasc_outname
124##            print 'asc_name ', str(asc_name)
125##           
126##            MaxAsc(maxasc_outname, asc_name)
Note: See TracBrowser for help on using the repository browser.