1 | import project_truescale, os |
---|
2 | import sys |
---|
3 | from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts |
---|
4 | from anuga.shallow_water.data_manager import sww2dem |
---|
5 | from os import sep |
---|
6 | |
---|
7 | res_dir1 = '20080725_051221_run_octuple_contour_polygons_lfountai' |
---|
8 | res_dir2 = '20080715_023223_run_quadruple_contour_polygons_lfountai' |
---|
9 | res_dir3 = '20080708_064841_run_double_contour_polygons_lfountai' |
---|
10 | res_dir4 = '20080708_064714_run_original_contour_polygons_lfountai' |
---|
11 | res_dir5 = '20080708_064815_run_half_contour_polygons_lfountai' |
---|
12 | res_dir6 = '20080714_231759_run_quarter_contour_polygons_lfountai' |
---|
13 | res_dir7 = '20080714_234934_run_eighth_contour_polygons_lfountai' |
---|
14 | res_dir8 = '20080714_235634_run_sixteenth_contour_polygons_lfountai' |
---|
15 | res_dir9 = '20080715_015727_run_1-32_contour_polygons_lfountai' |
---|
16 | res_dir10 = '20080721_015521_run_1-64_contour_polygons_lfountai' |
---|
17 | res_dirs = [#res_dir1, res_dir2, res_dir3, res_dir4, res_dir5, res_dir6, res_dir7, res_dir8, |
---|
18 | res_dir9, res_dir10] |
---|
19 | |
---|
20 | for res_dir in res_dirs: |
---|
21 | |
---|
22 | #timestep = 0 |
---|
23 | directory = project_truescale.output_dir+res_dir+sep |
---|
24 | name = directory+'okushiri_truescale' |
---|
25 | |
---|
26 | is_parallel = False |
---|
27 | #is_parallel = True |
---|
28 | |
---|
29 | if is_parallel == True: nodes = 10 |
---|
30 | print 'output directory:', directory |
---|
31 | |
---|
32 | area = ['Deep', 'Mid', 'Shallow'] |
---|
33 | |
---|
34 | for which_area in area: |
---|
35 | if which_area == 'Deep': |
---|
36 | cellsize = 50 |
---|
37 | easting_min = project_truescale.xminDeep |
---|
38 | easting_max = project_truescale.xmaxDeep |
---|
39 | northing_min = project_truescale.yminDeep |
---|
40 | northing_max = project_truescale.ymaxDeep |
---|
41 | |
---|
42 | if which_area == 'Mid': |
---|
43 | cellsize = 25 |
---|
44 | easting_min = project_truescale.xminMid |
---|
45 | easting_max = project_truescale.xmaxMid |
---|
46 | northing_min = project_truescale.yminMid |
---|
47 | northing_max = project_truescale.ymaxMid |
---|
48 | |
---|
49 | if which_area == 'Shallow': |
---|
50 | cellsize = 10 |
---|
51 | easting_min = project_truescale.xminShallow |
---|
52 | easting_max = project_truescale.xmaxShallow |
---|
53 | northing_min = project_truescale.yminShallow |
---|
54 | northing_max = project_truescale.ymaxShallow |
---|
55 | |
---|
56 | |
---|
57 | # var = [2,3,4] # depth and speed |
---|
58 | #var = [2] # depth |
---|
59 | var = [0,4] |
---|
60 | |
---|
61 | for which_var in var: |
---|
62 | if which_var == 0: # Stage |
---|
63 | outname = directory + which_area + '_stage' |
---|
64 | quantityname = 'stage' |
---|
65 | |
---|
66 | if which_var == 1: # Absolute Momentum |
---|
67 | outname = directory + which_area + '_momentum' |
---|
68 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
69 | |
---|
70 | if which_var == 2: # Depth |
---|
71 | outname = directory + which_area + '_depth' |
---|
72 | quantityname = 'stage-elevation' |
---|
73 | |
---|
74 | if which_var == 3: # Speed |
---|
75 | outname = directory + which_area + '_speed' |
---|
76 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed |
---|
77 | |
---|
78 | if which_var == 4: # Elevation |
---|
79 | outname = directory + which_area + '_elevation' |
---|
80 | quantityname = 'elevation' |
---|
81 | |
---|
82 | ## if is_parallel == True: |
---|
83 | ## # print 'is_parallel',is_parallel |
---|
84 | ## for i in range(0,nodes): |
---|
85 | ## namei = name + '_P%d_%d' %(i,nodes) |
---|
86 | ## outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
87 | ## print 'start sww2dem for sww file %d' %(i) |
---|
88 | ## sww2dem(namei, basename_out = outnamei, |
---|
89 | ## quantity = quantityname, |
---|
90 | ## timestep = timestep, |
---|
91 | ## cellsize = cellsize, |
---|
92 | ## easting_min = project_grad.e_min_area, |
---|
93 | ## easting_max = project_grad.e_max_area, |
---|
94 | ## northing_min = project_grad.n_min_area, |
---|
95 | ## northing_max = project_grad.n_max_area, |
---|
96 | ## reduction = max, |
---|
97 | ## verbose = True, |
---|
98 | ## format = 'asc') |
---|
99 | ## else: |
---|
100 | print 'start sww2dem', which_area |
---|
101 | sww2dem(name, basename_out = outname, |
---|
102 | quantity = quantityname, |
---|
103 | #timestep = timestep, |
---|
104 | cellsize = cellsize, |
---|
105 | easting_min = easting_min, |
---|
106 | easting_max = easting_max, |
---|
107 | northing_min = northing_min, |
---|
108 | northing_max = northing_max, |
---|
109 | reduction = max, |
---|
110 | verbose = True, |
---|
111 | format = 'ers') |
---|
112 | |
---|