1 | import project, os |
---|
2 | import sys |
---|
3 | |
---|
4 | from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts |
---|
5 | from anuga.shallow_water.data_manager import sww2dem |
---|
6 | from os import sep |
---|
7 | |
---|
8 | |
---|
9 | #time_dir = '20080815_103708_run_final_0.6_polyline_newExtent_kvanputt' |
---|
10 | time_dir = '20080815_103818_run_final_0_polyline_newExtent_kvanputt' |
---|
11 | |
---|
12 | is_parallel = False |
---|
13 | #is_parallel = True |
---|
14 | if is_parallel == True: nodes = 4 |
---|
15 | |
---|
16 | |
---|
17 | cellsize = 15 |
---|
18 | #timestep = 0 |
---|
19 | directory = project.output_dir |
---|
20 | name1 = directory+time_dir+sep+project.scenario_name |
---|
21 | name2 = directory+time_dir+sep+'busselton_time_38340'+sep+project.scenario_name+'_time_38340_0' |
---|
22 | |
---|
23 | names= [name1, name2] |
---|
24 | for name in names: |
---|
25 | |
---|
26 | area = ['Busselton', 'Bunbury', 'Dunsborough'] |
---|
27 | |
---|
28 | for which_area in area: |
---|
29 | if which_area == 'Busselton': |
---|
30 | easting_min = project.xminBusselton |
---|
31 | easting_max = project.xmaxBusselton |
---|
32 | northing_min = project.yminBusselton |
---|
33 | northing_max = project.ymaxBusselton |
---|
34 | |
---|
35 | if which_area == 'Bunbury': |
---|
36 | easting_min = project.xminBunbury |
---|
37 | easting_max = project.xmaxBunbury |
---|
38 | northing_min = project.yminBunbury |
---|
39 | northing_max = project.ymaxBunbury |
---|
40 | |
---|
41 | var = [2] # momentum and depth |
---|
42 | #var = [2] # depth |
---|
43 | #var = [0,4] |
---|
44 | |
---|
45 | for which_var in var: |
---|
46 | if which_var == 0: # Stage |
---|
47 | outname = name + which_area + '_stage' |
---|
48 | quantityname = 'stage' |
---|
49 | |
---|
50 | if which_var == 1: # Absolute Momentum |
---|
51 | outname = name + which_area + '_momentum' |
---|
52 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
53 | |
---|
54 | if which_var == 2: # Depth |
---|
55 | outname = name + which_area + '_depth' |
---|
56 | quantityname = 'stage-elevation' |
---|
57 | |
---|
58 | if which_var == 3: # Speed |
---|
59 | outname = name + which_area + '_speed' |
---|
60 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed |
---|
61 | |
---|
62 | if which_var == 4: # Elevation |
---|
63 | outname = name + which_area + '_elevation' |
---|
64 | quantityname = 'elevation' #Elevation |
---|
65 | |
---|
66 | if is_parallel == True: |
---|
67 | # print 'is_parallel',is_parallel |
---|
68 | for i in range(0,nodes): |
---|
69 | namei = name + '_P%d_%d' %(i,nodes) |
---|
70 | outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
71 | print 'start sww2dem for sww file %d' %(i) |
---|
72 | sww2dem(namei, basename_out = outnamei, |
---|
73 | quantity = quantityname, |
---|
74 | #timestep = timestep, |
---|
75 | cellsize = cellsize, |
---|
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 | else: |
---|
84 | print 'start sww2dem',which_area, easting_min,name,outname |
---|
85 | sww2dem(name, basename_out = outname, |
---|
86 | quantity = quantityname, |
---|
87 | #timestep = timestep, |
---|
88 | cellsize = cellsize, |
---|
89 | easting_min = easting_min, |
---|
90 | easting_max = easting_max, |
---|
91 | northing_min = northing_min, |
---|
92 | northing_max = northing_max, |
---|
93 | reduction = max, |
---|
94 | verbose = True, |
---|
95 | format = 'asc') |
---|
96 | |
---|