source: anuga_work/production/gosford/export_results_max.py @ 6684

Last change on this file since 6684 was 6684, checked in by kristy, 16 years ago

added Gosford

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