1 | import project_urs, os |
---|
2 | import sys |
---|
3 | |
---|
4 | from anuga.shallow_water.data_manager import sww2dem |
---|
5 | from os import sep |
---|
6 | |
---|
7 | #time_dir = '20070518_020117_run_final_3.6_nbartzis' # HAT 1 in Dampier 10000 yr |
---|
8 | #time_dir = '20070520_225029_run_final_0.0_nbartzis' # MSL 1 in Dampier 10000 yr |
---|
9 | time_dir = '20070613_061053_run_final_3.6_onslow_nbartzis' # HAT 1 in Onslow 10000 yr |
---|
10 | #time_dir = '20070613_061125_run_final_0.0_onslow_nbartzis' # MSL 1 in Onslow 10000 yr |
---|
11 | #time_dir = '20070613_044204_run_final_3.6_exmouth_nbartzis' # HAT 1 in Exmouth 10000 yr |
---|
12 | #time_dir = '20070613_225854_run_final_0.0_exmouth_nbartzis' # MSL 1 in Exmouth 10000 yr |
---|
13 | |
---|
14 | cellsize = 25 |
---|
15 | timestep = None |
---|
16 | directory = project_urs.output_dir |
---|
17 | |
---|
18 | name = directory+time_dir+sep+project_urs.scenario_name |
---|
19 | |
---|
20 | is_parallel = False |
---|
21 | if is_parallel == True: nodes = 4 |
---|
22 | print 'output dir:', name |
---|
23 | |
---|
24 | var = [0,2,3,4] # depth and speed |
---|
25 | |
---|
26 | for which_var in var: |
---|
27 | if which_var == 0: # Stage |
---|
28 | outname = name + '_stage' |
---|
29 | quantityname = 'stage' |
---|
30 | |
---|
31 | if which_var == 1: # Absolute Momentum |
---|
32 | outname = name + '_momentum_i1' |
---|
33 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
34 | |
---|
35 | if which_var == 2: # Depth |
---|
36 | outname = name + '_depth_facility' |
---|
37 | quantityname = 'stage-elevation' |
---|
38 | |
---|
39 | if which_var == 3: # Speed |
---|
40 | outname = name + '_speed_facility' |
---|
41 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed |
---|
42 | |
---|
43 | if which_var == 4: # Elevation |
---|
44 | outname = name + '_elevation' |
---|
45 | quantityname = 'elevation' #Elevation |
---|
46 | |
---|
47 | if is_parallel == True: |
---|
48 | # print 'is_parallel',is_parallel |
---|
49 | for i in range(0,nodes): |
---|
50 | namei = name + '_P%d_%d' %(i,nodes) |
---|
51 | outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
52 | print 'start sww2dem for sww file %d' %(i) |
---|
53 | sww2dem(namei, basename_out = outnamei, |
---|
54 | quantity = quantityname, |
---|
55 | timestep = timestep, |
---|
56 | cellsize = cellsize, |
---|
57 | easting_min = project_urs.e_min_area, |
---|
58 | easting_max = project_urs.e_max_area, |
---|
59 | northing_min = project_urs.n_min_area, |
---|
60 | northing_max = project_urs.n_max_area, |
---|
61 | reduction = max, |
---|
62 | verbose = True, |
---|
63 | format = 'asc') |
---|
64 | else: |
---|
65 | print 'start sww2dem' |
---|
66 | sww2dem(name, basename_out = outname, |
---|
67 | quantity = quantityname, |
---|
68 | timestep = timestep, |
---|
69 | cellsize = cellsize, |
---|
70 | easting_min = project_urs.e_min_area, |
---|
71 | easting_max = project_urs.e_max_area, |
---|
72 | northing_min = project_urs.n_min_area, |
---|
73 | northing_max = project_urs.n_max_area, |
---|
74 | reduction = max, |
---|
75 | verbose = True, |
---|
76 | format = 'asc') |
---|