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