source: anuga_work/production/australia_ph2/dampier/export_results_max.py @ 6443

Last change on this file since 6443 was 6443, checked in by kristy, 15 years ago

New boundary created through one csv time series file

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