source: anuga_work/production/australia_ph2/sydney/export_results_all.py @ 6176

Last change on this file since 6176 was 6176, checked in by jgriffin, 15 years ago

Folder created for phase 2 scripts.
Basic scripts started for Sydney.

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