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 = '20080526_104946_run_final_0.6_test_kvanputt' |
---|
8 | #time_dir = '20080530_170833_run_final_0.6_exmouth_kvanputt' |
---|
9 | time_dir = '20080619_115643_run_trial_0.6_exmouth_kvanputt' |
---|
10 | |
---|
11 | |
---|
12 | |
---|
13 | cellsize = 10 |
---|
14 | #cellsize = 150 |
---|
15 | timestep = 0 |
---|
16 | directory = project.output_dir |
---|
17 | name = directory+time_dir+sep+project.scenario_name |
---|
18 | |
---|
19 | from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts |
---|
20 | |
---|
21 | |
---|
22 | is_parallel = False |
---|
23 | #is_parallel = True |
---|
24 | |
---|
25 | if is_parallel == True: nodes = 4 |
---|
26 | print 'output dir:', name |
---|
27 | |
---|
28 | area = ['Geordie', 'Sorrento', 'Perth', 'Rockingham'] |
---|
29 | |
---|
30 | for which_area in area: |
---|
31 | if which_area == 'Geordie': |
---|
32 | easting_min = project.xminGeordie |
---|
33 | easting_max = project.xmaxGeordie |
---|
34 | northing_min = project.yminGeordie |
---|
35 | northing_max = project.ymaxGeordie |
---|
36 | |
---|
37 | if which_area == 'Sorrento': |
---|
38 | easting_min = project.xminSorrento |
---|
39 | easting_max = project.xmaxSorrento |
---|
40 | northing_min = project.yminSorrento |
---|
41 | northing_max = project.ymaxSorrento |
---|
42 | |
---|
43 | if which_area == 'Perth': |
---|
44 | easting_min = project.xminPerth |
---|
45 | easting_max = project.xmaxPerth |
---|
46 | northing_min = project.yminPerth |
---|
47 | northing_max = project.ymaxPerth |
---|
48 | |
---|
49 | if which_area == 'Rockingham': |
---|
50 | easting_min = project.xminRockingham |
---|
51 | easting_max = project.xmaxRockingham |
---|
52 | northing_min = project.yminRockingham |
---|
53 | northing_max = project.ymaxRockingham |
---|
54 | |
---|
55 | # var = [2,3,4] # depth and speed |
---|
56 | #var = [2] # depth |
---|
57 | var = [0,4] |
---|
58 | |
---|
59 | for which_var in var: |
---|
60 | if which_var == 0: # Stage |
---|
61 | outname = name + which_area + '_stage' |
---|
62 | quantityname = 'stage' |
---|
63 | |
---|
64 | if which_var == 1: # Absolute Momentum |
---|
65 | outname = name + which_area + '_momentum' |
---|
66 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
67 | |
---|
68 | if which_var == 2: # Depth |
---|
69 | outname = name + which_area + '_depth' |
---|
70 | quantityname = 'stage-elevation' |
---|
71 | |
---|
72 | if which_var == 3: # Speed |
---|
73 | outname = name + which_area + '_speed' |
---|
74 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed |
---|
75 | |
---|
76 | if which_var == 4: # Elevation |
---|
77 | outname = name + which_area + '_elevation' |
---|
78 | quantityname = 'elevation' #Elevation |
---|
79 | |
---|
80 | if is_parallel == True: |
---|
81 | # print 'is_parallel',is_parallel |
---|
82 | for i in range(0,nodes): |
---|
83 | namei = name + '_P%d_%d' %(i,nodes) |
---|
84 | outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
85 | print 'start sww2dem for sww file %d' %(i) |
---|
86 | sww2dem(namei, basename_out = outnamei, |
---|
87 | quantity = quantityname, |
---|
88 | timestep = timestep, |
---|
89 | cellsize = cellsize, |
---|
90 | easting_min = project_grad.e_min_area, |
---|
91 | easting_max = project_grad.e_max_area, |
---|
92 | northing_min = project_grad.n_min_area, |
---|
93 | northing_max = project_grad.n_max_area, |
---|
94 | reduction = max, |
---|
95 | verbose = True, |
---|
96 | format = 'asc') |
---|
97 | else: |
---|
98 | print 'start sww2dem',which_area, easting_min |
---|
99 | sww2dem(name, basename_out = outname, |
---|
100 | quantity = quantityname, |
---|
101 | timestep = timestep, |
---|
102 | cellsize = cellsize, |
---|
103 | easting_min = easting_min, |
---|
104 | easting_max = easting_max, |
---|
105 | northing_min = northing_min, |
---|
106 | northing_max = northing_max, |
---|
107 | reduction = max, |
---|
108 | verbose = True, |
---|
109 | format = 'asc') |
---|
110 | |
---|