source: anuga_work/production/geraldton/export_results_all.py @ 5872

Last change on this file since 5872 was 5872, checked in by Leharne, 15 years ago

new export script to include comparison with 250m grid

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 = '20081002_110807_run_final_0_27283_250m_none_kvanputt' # This uses the 250m bathymetry without any interior polygons
23time_dir2 = '20081002_110950_run_final_0_27283_250m_all_kvanputt' # This uses the 250m bathymetry with all interior polygons
24#time_dir3 = '20080922_124041_run_final_0.6_27283_alpha0.1_kvanputt' # This uses original bathyemetry data
25#time_dir3 = '20080910_103239_run_final_0_elevation_alpha0.1_kvanputt' # check
26time_dir3 = '20081028_151842_run_final_0.0_27283_alpha0.1_lfountai'
27
28time_dirs = [time_dir1, time_dir2, time_dir3]
29
30#cellsize = 20
31cellsize = 250
32
33timestep = None    # None means no timestep!
34#timestep = 0
35
36######
37# Set the special areas of interest.  If none, do: area='All'
38######
39#area = ['Geordie', 'Sorrento', 'Fremantle', 'Rockingham']  # strings must match keys in var_equations below
40area = ['All']      # 'All' means no special areas - the whole thing
41
42######
43# Define allowed variable names and associated equations to generate values.
44# This would not normally change.
45######
46var_equations = {'stage':     'stage',
47                 'momentum':  '(xmomentum**2 + ymomentum**2)**0.5',
48                 'depth':     'stage-elevation',
49                 'speed':     '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6)',
50                 'elevation': 'elevation' }
51
52# one or more key strings from var_equations above
53var = ['stage', 'elevation']
54
55######
56# Start running the various conversions we require.
57######
58for time_dir in time_dirs:
59    name1 = directory+time_dir+sep+project.scenario_name
60#    name2 = directory+time_dir+sep+'sww2'+sep+project.scenario_name+'_time_39900_0' #need to get assistance on how to make this into anything
61    names = [name1]
62   
63    for name in names:
64        for which_area in area:
65            if which_area == 'All':
66                easting_min = None
67                easting_max = None
68                northing_min = None
69                northing_max = None
70            else:
71                try:
72                    easting_min = eval('project.xmin%s' % which_area)
73                    easting_max = eval('project.xmax%s' % which_area)
74                    northing_min = eval('project.ymin%s' % which_area)
75                    northing_max = eval('project.ymax%s' % which_area)
76                except AttributeError:
77                    print 'Unrecognized area name: %s' % which_area
78                    break
79             
80            for which_var in var:
81                if which_var not in var_equations:
82                    print 'Unrecognized variable name: %s' % which_var
83                    break
84
85                outname = name + which_area + '_' + which_var
86                quantityname = var_equations[which_var]
87
88                print 'start sww2dem: time_dir=%s' % time_dir
89               
90                sww2dem(name, basename_out = outname,
91                            quantity = quantityname,
92                            timestep = timestep,
93                            cellsize = cellsize,     
94                            easting_min = easting_min,
95                            easting_max = easting_max,
96                            northing_min = northing_min,
97                            northing_max = northing_max,       
98                            reduction = max, 
99                            verbose = True,
100                            format = 'asc')
Note: See TracBrowser for help on using the repository browser.