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 = '20070618_035101_run_final_1.4_dampier_nbartzis' # HAT 1 in Dampier 10000 yr |
---|
8 | #time_dir = '20070618_035114_run_final_0_dampier_nbartzis' # MSL 1 in Dampier 10000 yr |
---|
9 | #time_dir = '20070619_042043_run_final_1.4_onslow_nbartzis' # HAT 1 in Onslow 10000 yr |
---|
10 | #time_dir = '20070619_042140_run_final_0_onslow_nbartzis' # MSL 1 in Onslow 10000 yr |
---|
11 | #time_dir = '20070619_042542_run_final_1.4_exmouth_nbartzis' # HAT 1 in Exmouth 10000 yr |
---|
12 | #time_dir = '20070619_042417_run_final_0_exmouth_nbartzis' # MSL 1 in Exmouth 10000 yr |
---|
13 | #time_dir = '20080610_041607_run_final_1.4_exmouth_kvanputt' # HAT 1 in Exmouth 10000 yr |
---|
14 | time_dir = '20080613_055032_run_final_1.4_exmouth_kvanputt' # HAT 1 in Exmouth 10000 yr slope 1 |
---|
15 | |
---|
16 | cellsize = 25 |
---|
17 | timestep = None |
---|
18 | directory = project.output_dir |
---|
19 | |
---|
20 | name = directory+time_dir+sep+project.scenario_name |
---|
21 | |
---|
22 | is_parallel = False |
---|
23 | if is_parallel == True: nodes = 4 |
---|
24 | print 'output dir:', name |
---|
25 | |
---|
26 | var = [2,3, 4] # depth and speed |
---|
27 | |
---|
28 | for which_var in var: |
---|
29 | if which_var == 0: # Stage |
---|
30 | outname = name + '_stage' |
---|
31 | quantityname = 'stage' |
---|
32 | |
---|
33 | if which_var == 1: # Absolute Momentum |
---|
34 | outname = name + '_momentum_i1' |
---|
35 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
36 | |
---|
37 | if which_var == 2: # Depth |
---|
38 | outname = name + '_depth' |
---|
39 | quantityname = 'stage-elevation' |
---|
40 | |
---|
41 | if which_var == 3: # Speed |
---|
42 | outname = name + '_speed' |
---|
43 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed |
---|
44 | |
---|
45 | if which_var == 4: # Elevation |
---|
46 | outname = name + '_elevation' |
---|
47 | quantityname = 'elevation' #Elevation |
---|
48 | |
---|
49 | if is_parallel == True: |
---|
50 | # print 'is_parallel',is_parallel |
---|
51 | for i in range(0,nodes): |
---|
52 | namei = name + '_P%d_%d' %(i,nodes) |
---|
53 | outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
54 | print 'start sww2dem for sww file %d' %(i) |
---|
55 | sww2dem(namei, basename_out = outnamei, |
---|
56 | quantity = quantityname, |
---|
57 | timestep = timestep, |
---|
58 | cellsize = cellsize, |
---|
59 | easting_min = project.e_min_area, |
---|
60 | easting_max = project.e_max_area, |
---|
61 | northing_min = project.n_min_area, |
---|
62 | northing_max = project.n_max_area, |
---|
63 | reduction = max, |
---|
64 | verbose = True, |
---|
65 | format = 'asc') |
---|
66 | else: |
---|
67 | print 'start sww2dem' |
---|
68 | sww2dem(name, basename_out = outname, |
---|
69 | quantity = quantityname, |
---|
70 | timestep = timestep, |
---|
71 | cellsize = cellsize, |
---|
72 | easting_min = project.eastingmin, |
---|
73 | easting_max = project.eastingmax, |
---|
74 | northing_min = project.northingmin, |
---|
75 | northing_max = project.northingmax, |
---|
76 | reduction = max, |
---|
77 | verbose = True, |
---|
78 | format = 'asc') |
---|