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 = '20080630_104134_run_trial_0.6_exmouth_5449_kvanputt' |
---|
8 | #time_dir = '20080630_111936_run_trial_0.6_exmouth_4695_kvanputt' |
---|
9 | #time_dir = '20080630_112512_run_trial_0.6_exmouth_4743_kvanputt' |
---|
10 | #time_dir = '20080630_112830_run_trial_0.6_exmouth_4777_kvanputt' |
---|
11 | #time_dir = '20080630_114135_run_trial_0.6_exmouth_4901_kvanputt' |
---|
12 | #time_dir = '20080630_114503_run_trial_0.6_exmouth_4874_kvanputt' |
---|
13 | #time_dir = '20080630_114811_run_trial_0.6_exmouth_4990_kvanputt' |
---|
14 | #time_dir = '20080630_115238_run_trial_0.6_exmouth_5103_kvanputt' |
---|
15 | #time_dir = '20080630_115458_run_trial_0.6_exmouth_5185_kvanputt' |
---|
16 | #time_dir = '20080630_115757_run_trial_0.6_exmouth_5273_kvanputt' |
---|
17 | #time_dir = '20080707_164738_run_trial_0.6_exmouth_5120_kvanputt' |
---|
18 | #time_dir = '20080707_165101_run_trial_0.6_exmouth_5140_kvanputt' |
---|
19 | time_dir = '20080707_165619_run_trial_0.6_exmouth_5160_kvanputt' |
---|
20 | |
---|
21 | |
---|
22 | cellsize = 25 |
---|
23 | #cellsize = 150 |
---|
24 | #timestep = 0 |
---|
25 | directory = project.output_dir |
---|
26 | name = directory+sep+'test'+sep+time_dir+sep+project.scenario_name |
---|
27 | |
---|
28 | from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts |
---|
29 | |
---|
30 | |
---|
31 | is_parallel = False |
---|
32 | #is_parallel = True |
---|
33 | |
---|
34 | if is_parallel == True: nodes = 4 |
---|
35 | print 'output dir:', name |
---|
36 | |
---|
37 | #var = [0,4] |
---|
38 | #var = [2,3] # depth and Speed |
---|
39 | var = [2,3,4] # elevation, depth and Speed |
---|
40 | |
---|
41 | |
---|
42 | for which_var in var: |
---|
43 | if which_var == 0: # Stage |
---|
44 | outname = name + '_stage' |
---|
45 | quantityname = 'stage' |
---|
46 | |
---|
47 | if which_var == 1: # Absolute Momentum |
---|
48 | outname = name + '_momentum' |
---|
49 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
50 | |
---|
51 | if which_var == 2: # Depth |
---|
52 | outname = name + '_depth' |
---|
53 | quantityname = 'stage-elevation' |
---|
54 | |
---|
55 | if which_var == 3: # Speed |
---|
56 | outname = name + '_speed' |
---|
57 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed |
---|
58 | |
---|
59 | if which_var == 4: # Elevation |
---|
60 | outname = name + '_elevation' |
---|
61 | quantityname = 'elevation' #Elevation |
---|
62 | |
---|
63 | if is_parallel == True: |
---|
64 | # print 'is_parallel',is_parallel |
---|
65 | for i in range(0,nodes): |
---|
66 | namei = name + '_P%d_%d' %(i,nodes) |
---|
67 | outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
68 | print 'start sww2dem for sww file %d' %(i) |
---|
69 | sww2dem(namei, basename_out = outnamei, |
---|
70 | quantity = quantityname, |
---|
71 | #timestep = timestep, |
---|
72 | cellsize = cellsize, |
---|
73 | easting_min = project_grad.e_min_area, |
---|
74 | easting_max = project_grad.e_max_area, |
---|
75 | northing_min = project_grad.n_min_area, |
---|
76 | northing_max = project_grad.n_max_area, |
---|
77 | reduction = max, |
---|
78 | verbose = True, |
---|
79 | format = 'asc') |
---|
80 | else: |
---|
81 | print 'start sww2dem' |
---|
82 | sww2dem(name, basename_out = outname, |
---|
83 | quantity = quantityname, |
---|
84 | #timestep = timestep, |
---|
85 | cellsize = cellsize, |
---|
86 | #easting_min = project_grad.e_min_area, |
---|
87 | #easting_max = project_grad.e_max_area, |
---|
88 | #northing_min = project_grad.n_min_area, |
---|
89 | #northing_max = project_grad.n_max_area, |
---|
90 | reduction = max, |
---|
91 | verbose = True, |
---|
92 | format = 'asc') |
---|
93 | |
---|