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