1 | import project_slide, os |
---|
2 | import sys |
---|
3 | |
---|
4 | from anuga.shallow_water.data_manager import sww2dem |
---|
5 | from os import sep |
---|
6 | |
---|
7 | time_dir = '20061211_060105' |
---|
8 | directory = project_slide.outputdir |
---|
9 | name = directory + time_dir + sep + project_slide.basename |
---|
10 | |
---|
11 | is_parallel = False |
---|
12 | if is_parallel == True: nodes = 4 |
---|
13 | print 'output dir:', name |
---|
14 | |
---|
15 | which_var = 2 |
---|
16 | if which_var == 0: # Stage |
---|
17 | outname = name + '_stage' |
---|
18 | quantityname = 'stage' |
---|
19 | |
---|
20 | if which_var == 1: # Absolute Momentum |
---|
21 | outname = name + '_momentum_i1' |
---|
22 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
23 | |
---|
24 | if which_var == 2: # Depth |
---|
25 | outname = name + '_depth' |
---|
26 | quantityname = 'stage-elevation' |
---|
27 | |
---|
28 | if which_var == 3: # Speed |
---|
29 | outname = name + '_speed_i0' |
---|
30 | #quantityname = '((xmomentum/(stage-elevation))**2 + (ymomentum/(stage-elevation))**2)**0.5' #Speed |
---|
31 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-30)' #Speed |
---|
32 | |
---|
33 | if which_var == 4: # Elevation |
---|
34 | outname = name + '_elevation' |
---|
35 | quantityname = 'elevation' #Elevation |
---|
36 | |
---|
37 | if is_parallel == True: |
---|
38 | for i in range(0,nodes): |
---|
39 | namei = name + '_P%d_%d' %(i,nodes) |
---|
40 | outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
41 | print 'start sww2dem for sww file %d' %(i) |
---|
42 | sww2dem(namei, basename_out = outnamei, |
---|
43 | quantity = quantityname, |
---|
44 | timestep = 1, |
---|
45 | cellsize = 100, |
---|
46 | #easting_min = project.e_min_area, |
---|
47 | #easting_max = project.e_max_area, |
---|
48 | #northing_min = project.n_min_area, |
---|
49 | #northing_max = project.n_max_area, |
---|
50 | reduction = max, |
---|
51 | verbose = True, |
---|
52 | format = 'asc') |
---|
53 | else: |
---|
54 | print 'start sww2dem' |
---|
55 | sww2dem(name, basename_out = outname, |
---|
56 | quantity = quantityname, |
---|
57 | cellsize = 20, |
---|
58 | easting_min = project_slide.eastingmin, |
---|
59 | easting_max = project_slide.eastingmax, |
---|
60 | northing_min = project_slide.northingmin, |
---|
61 | northing_max = project_slide.northingmax, |
---|
62 | reduction = max, |
---|
63 | verbose = True, |
---|
64 | format = 'asc') |
---|