1 | import project, os |
---|
2 | import sys |
---|
3 | |
---|
4 | from anuga.shallow_water.data_manager import sww2dem |
---|
5 | from os import sep |
---|
6 | |
---|
7 | |
---|
8 | time_dir = '20080619_092128_run_trial_0.6_exmouth_current_kvanputt' |
---|
9 | |
---|
10 | |
---|
11 | |
---|
12 | cellsize = 10 |
---|
13 | #cellsize = 150 |
---|
14 | timestep = 0 |
---|
15 | directory = project.output_dir |
---|
16 | name = directory+'test'+sep+time_dir+sep+project.scenario_name # test folder take out!! |
---|
17 | |
---|
18 | from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts |
---|
19 | |
---|
20 | |
---|
21 | is_parallel = False |
---|
22 | #is_parallel = True |
---|
23 | |
---|
24 | if is_parallel == True: nodes = 4 |
---|
25 | print 'output dir:', name |
---|
26 | |
---|
27 | area = ['Busselton', 'Bunbury'] |
---|
28 | |
---|
29 | for which_area in area: |
---|
30 | if which_area == 'Busselton': |
---|
31 | easting_min = project.xminBusselton |
---|
32 | easting_max = project.xmaxBusselton |
---|
33 | northing_min = project.yminBusselton |
---|
34 | northing_max = project.ymaxBusselton |
---|
35 | |
---|
36 | if which_area == 'Bunbury': |
---|
37 | easting_min = project.xminBunbury |
---|
38 | easting_max = project.xmaxBunbury |
---|
39 | northing_min = project.yminBunbury |
---|
40 | northing_max = project.ymaxBunbury |
---|
41 | |
---|
42 | if which_area == 'Dunsborough': |
---|
43 | easting_min = project.xminDunsborough |
---|
44 | easting_max = project.xmaxDunsborough |
---|
45 | northing_min = project.yminDunsborough |
---|
46 | northing_max = project.ymaxDunsborough |
---|
47 | |
---|
48 | # var = [2,3,4] # depth and speed |
---|
49 | #var = [2] # depth |
---|
50 | var = [0,4] |
---|
51 | |
---|
52 | for which_var in var: |
---|
53 | if which_var == 0: # Stage |
---|
54 | outname = name + which_area + '_stage' |
---|
55 | quantityname = 'stage' |
---|
56 | |
---|
57 | if which_var == 1: # Absolute Momentum |
---|
58 | outname = name + which_area + '_momentum' |
---|
59 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
60 | |
---|
61 | if which_var == 2: # Depth |
---|
62 | outname = name + which_area + '_depth' |
---|
63 | quantityname = 'stage-elevation' |
---|
64 | |
---|
65 | if which_var == 3: # Speed |
---|
66 | outname = name + which_area + '_speed' |
---|
67 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed |
---|
68 | |
---|
69 | if which_var == 4: # Elevation |
---|
70 | outname = name + which_area + '_elevation' |
---|
71 | quantityname = 'elevation' #Elevation |
---|
72 | |
---|
73 | if is_parallel == True: |
---|
74 | # print 'is_parallel',is_parallel |
---|
75 | for i in range(0,nodes): |
---|
76 | namei = name + '_P%d_%d' %(i,nodes) |
---|
77 | outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
78 | print 'start sww2dem for sww file %d' %(i) |
---|
79 | sww2dem(namei, basename_out = outnamei, |
---|
80 | quantity = quantityname, |
---|
81 | #timestep = timestep, |
---|
82 | cellsize = cellsize, |
---|
83 | easting_min = project_grad.e_min_area, |
---|
84 | easting_max = project_grad.e_max_area, |
---|
85 | northing_min = project_grad.n_min_area, |
---|
86 | northing_max = project_grad.n_max_area, |
---|
87 | reduction = max, |
---|
88 | verbose = True, |
---|
89 | format = 'asc') |
---|
90 | else: |
---|
91 | print 'start sww2dem',which_area, easting_min,name,outname |
---|
92 | sww2dem(name, basename_out = outname, |
---|
93 | quantity = quantityname, |
---|
94 | timestep = timestep, |
---|
95 | cellsize = cellsize, |
---|
96 | easting_min = easting_min, |
---|
97 | easting_max = easting_max, |
---|
98 | northing_min = northing_min, |
---|
99 | northing_max = northing_max, |
---|
100 | reduction = max, |
---|
101 | verbose = True, |
---|
102 | format = 'asc') |
---|
103 | |
---|