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