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 = '20080530_170705_run_final_0.6_exmouth_kvanputt' |
---|
8 | #time_dir = '20080619_115523_run_trial_0.6_exmouth_current_kvanputt' |
---|
9 | #time_dir = '20080624_172109_run_final_0.6_exmouth_0.1_kvanputt' |
---|
10 | #time_dir = '20080624_172126_run_final_0.6_exmouth_0.5_kvanputt' |
---|
11 | time_dir = '20080627_085741_run_final_0.6_exmouth_current_kvanputt' |
---|
12 | |
---|
13 | |
---|
14 | cellsize = 25 |
---|
15 | #cellsize = 150 |
---|
16 | timestep = 0 |
---|
17 | directory = project.output_dir |
---|
18 | name = directory+sep+'test'+sep+time_dir+sep+project.scenario_name |
---|
19 | |
---|
20 | from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts |
---|
21 | |
---|
22 | |
---|
23 | is_parallel = False |
---|
24 | #is_parallel = True |
---|
25 | |
---|
26 | if is_parallel == True: nodes = 4 |
---|
27 | print 'output dir:', name |
---|
28 | |
---|
29 | var = [0,4] |
---|
30 | #var = [2] # depth |
---|
31 | #var = [4] |
---|
32 | #var = [2] #depth |
---|
33 | |
---|
34 | for which_var in var: |
---|
35 | if which_var == 0: # Stage |
---|
36 | outname = name + '_stage' |
---|
37 | quantityname = 'stage' |
---|
38 | |
---|
39 | if which_var == 1: # Absolute Momentum |
---|
40 | outname = name + '_momentum' |
---|
41 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
42 | |
---|
43 | if which_var == 2: # Depth |
---|
44 | outname = name + '_depth' |
---|
45 | quantityname = 'stage-elevation' |
---|
46 | |
---|
47 | if which_var == 3: # Speed |
---|
48 | outname = name + '_speed' |
---|
49 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed |
---|
50 | |
---|
51 | if which_var == 4: # Elevation |
---|
52 | outname = name + '_elevation' |
---|
53 | quantityname = 'elevation' #Elevation |
---|
54 | |
---|
55 | if is_parallel == True: |
---|
56 | # print 'is_parallel',is_parallel |
---|
57 | for i in range(0,nodes): |
---|
58 | namei = name + '_P%d_%d' %(i,nodes) |
---|
59 | outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
60 | print 'start sww2dem for sww file %d' %(i) |
---|
61 | sww2dem(namei, basename_out = outnamei, |
---|
62 | quantity = quantityname, |
---|
63 | #timestep = timestep, |
---|
64 | cellsize = cellsize, |
---|
65 | easting_min = project_grad.e_min_area, |
---|
66 | easting_max = project_grad.e_max_area, |
---|
67 | northing_min = project_grad.n_min_area, |
---|
68 | northing_max = project_grad.n_max_area, |
---|
69 | reduction = max, |
---|
70 | verbose = True, |
---|
71 | format = 'asc') |
---|
72 | else: |
---|
73 | print 'start sww2dem' |
---|
74 | sww2dem(name, basename_out = outname, |
---|
75 | quantity = quantityname, |
---|
76 | timestep = timestep, |
---|
77 | cellsize = cellsize, |
---|
78 | #easting_min = project_grad.e_min_area, |
---|
79 | #easting_max = project_grad.e_max_area, |
---|
80 | #northing_min = project_grad.n_min_area, |
---|
81 | #northing_max = project_grad.n_max_area, |
---|
82 | reduction = max, |
---|
83 | verbose = True, |
---|
84 | format = 'asc') |
---|
85 | |
---|