source: anuga_work/production/perth/export_results_all.py @ 5761

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

Headers updated to link inputs and outputs

File size: 4.8 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
16
17from anuga.shallow_water.data_manager import sww2dem
18from os import sep
19
20directory = project.output_dir
21
22#time_dir = '20080526_104946_run_final_0.6_test_kvanputt'
23#time_dir = '20080530_170833_run_final_0.6_exmouth_kvanputt'
24time_dir1 = '20080815_103442_run_final_0.0_polyline_alpha0.1_kvanputt'
25time_dir2 = '20080909_151438_run_final_0.0_polyline_alpha0.1_kvanputt'
26
27#cellsize = 20
28cellsize = 30
29#timestep = 0
30#area = ['Geordie', 'Sorrento', 'Fremantle', 'Rockingham']
31area = ['All']
32#var = [1,2] # Absolute momentum and depth
33#var = [2] # depth
34var = [0,4] #stage and elevation
35
36time_dir = [time_dir1, time_dir2]
37for time_dir in time_dirs:
38
39    name1 = directory+time_dir+sep+project.scenario_name
40    name2 = directory+time_dir+sep+'sww2'+sep+project.scenario_name+'_time_39900_0' #need to get assistance on how to make this into anything
41
42    names = [name1, name2]
43    for name in names:
44
45        for which_area in area:
46            if which_area == 'All':
47           
48            if which_area == 'Geordie':
49                easting_min = project.xminGeordie
50                easting_max = project.xmaxGeordie
51                northing_min = project.yminGeordie
52                northing_max = project.ymaxGeordie
53
54            if which_area == 'Sorrento':
55                easting_min = project.xminSorrento
56                easting_max = project.xmaxSorrento
57                northing_min = project.yminSorrento
58                northing_max = project.ymaxSorrento
59
60            if which_area == 'Fremantle':
61                easting_min = project.xminFremantle
62                easting_max = project.xmaxFremantle
63                northing_min = project.yminFremantle
64                northing_max = project.ymaxFremantle
65
66            if which_area == 'Rockingham':
67                easting_min = project.xminRockingham
68                easting_max = project.xmaxRockingham
69                northing_min = project.yminRockingham
70                northing_max = project.ymaxRockingham
71
72             
73            for which_var in var:
74                if which_var == 0:  # Stage
75                    outname = name + which_area + '_stage' 
76                    quantityname = 'stage'
77
78                if which_var == 1:  # Absolute Momentum
79                    outname = name + which_area + '_momentum' 
80                    quantityname = '(xmomentum**2 + ymomentum**2)**0.5' 
81
82                if which_var == 2:  # Depth
83                    outname = name + which_area + '_depth'
84                    quantityname = 'stage-elevation' 
85
86                if which_var == 3:  # Speed
87                    outname = name + which_area + '_speed'
88                    #quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))'  #Speed
89                    quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6)'  #Speed
90                   
91                if which_var == 4:  # Elevation
92                    outname = name + which_area + '_elevation'
93                    quantityname = 'elevation'  #Elevation
94
95                if which_area == 'All'
96                    print 'start sww2dem',which_area
97                    sww2dem(name, basename_out = outname,
98                                quantity = quantityname,
99                                #timestep = timestep,
100                                cellsize = cellsize,     
101                                reduction = max, 
102                                verbose = True,
103                                format = 'asc')
104
105                else:
106                    print 'start sww2dem',which_area, easting_min
107                    sww2dem(name, basename_out = outname,
108                                quantity = quantityname,
109                                #timestep = timestep,
110                                cellsize = cellsize,     
111                                easting_min = easting_min,
112                                easting_max = easting_max,
113                                northing_min = northing_min,
114                                northing_max = northing_max,       
115                                reduction = max, 
116                                verbose = True,
117                                format = 'asc')
118
Note: See TracBrowser for help on using the repository browser.