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