1 | import project, os |
---|
2 | import sys |
---|
3 | |
---|
4 | from anuga.shallow_water.data_manager import sww2dem |
---|
5 | from os import sep |
---|
6 | |
---|
7 | #time_dir = '20070711_034317_run_final_0.0_shark_bay_onielsen_10000_tide0.0_coastpolys' # July 2006 event; small domain |
---|
8 | #time_dir = '20070710_023824_run_final_-0.85_shark_bay_onielsen_july2006_tide-0.85_coastpolys' # July 2006; larger domain |
---|
9 | time_dir = '20070717_021240_run_final_0.79_shark_bay_onielsen_experimental_A0.5_T1200' |
---|
10 | cellsize = 10 |
---|
11 | timestep = None |
---|
12 | directory = project.output_dir |
---|
13 | |
---|
14 | name = directory+time_dir+sep+project.scenario_name |
---|
15 | |
---|
16 | is_parallel = False |
---|
17 | if is_parallel == True: nodes = 4 |
---|
18 | print 'output dir:', name |
---|
19 | |
---|
20 | #var = [0,2,3] # stage, depth and speed |
---|
21 | var = [4] |
---|
22 | |
---|
23 | for which_var in var: |
---|
24 | if which_var == 0: # Stage |
---|
25 | outname = name + '_stage' |
---|
26 | quantityname = 'stage' |
---|
27 | |
---|
28 | if which_var == 1: # Absolute Momentum |
---|
29 | outname = name + '_momentum_i1' |
---|
30 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
31 | |
---|
32 | if which_var == 2: # Depth |
---|
33 | outname = name + '_depth' |
---|
34 | quantityname = 'stage-elevation' |
---|
35 | |
---|
36 | if which_var == 3: # Speed |
---|
37 | outname = name + '_speed' |
---|
38 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed |
---|
39 | |
---|
40 | if which_var == 4: # Elevation |
---|
41 | outname = name + '_elevation' |
---|
42 | quantityname = 'elevation' #Elevation |
---|
43 | |
---|
44 | if is_parallel == True: |
---|
45 | # print 'is_parallel',is_parallel |
---|
46 | for i in range(0,nodes): |
---|
47 | namei = name + '_P%d_%d' %(i,nodes) |
---|
48 | outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
49 | print 'start sww2dem for sww file %d' %(i) |
---|
50 | sww2dem(namei, basename_out = outnamei, |
---|
51 | quantity = quantityname, |
---|
52 | timestep = timestep, |
---|
53 | cellsize = cellsize, |
---|
54 | easting_min = project.e_min_area, |
---|
55 | easting_max = project.e_max_area, |
---|
56 | northing_min = project.n_min_area, |
---|
57 | northing_max = project.n_max_area, |
---|
58 | reduction = max, |
---|
59 | verbose = True, |
---|
60 | format = 'asc') |
---|
61 | else: |
---|
62 | print 'start sww2dem' |
---|
63 | sww2dem(name, basename_out = outname, |
---|
64 | quantity = quantityname, |
---|
65 | timestep = timestep, |
---|
66 | cellsize = cellsize, |
---|
67 | easting_min = project.e_min_area, |
---|
68 | easting_max = project.e_max_area, |
---|
69 | northing_min = project.n_min_area, |
---|
70 | northing_max = project.n_max_area, |
---|
71 | reduction = max, |
---|
72 | verbose = True, |
---|
73 | format = 'asc') |
---|