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