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 = '' # HAT 1 in Dampier 10000 yr |
---|
8 | #time_dir = '' # MSL 1 in Dampier 10000 yr |
---|
9 | #time_dir = '' # HAT 1 in Broome 10000 yr |
---|
10 | #time_dir = '' # MSL 1 in Broome 10000 yr |
---|
11 | #time_dir = '' # HAT 1 in Pt Hedland 10000 yr |
---|
12 | #time_dir = '' # MSL 1 in Pt Hedland 10000 yr |
---|
13 | #time_dir = '' # HAT 1 in Onslow 10000 yr |
---|
14 | #time_dir = '' # MSL 1 in Onslow 10000 yr |
---|
15 | #time_dir = '' # HAT 1 in Exmouth 10000 yr |
---|
16 | #time_dir = '' # MSL 1 in Exmouth 10000 yr |
---|
17 | cellsize = 25 |
---|
18 | timestep = None |
---|
19 | directory = project.output_dir |
---|
20 | |
---|
21 | name = directory+time_dir+sep+project.scenario_name |
---|
22 | |
---|
23 | is_parallel = True |
---|
24 | if is_parallel == True: nodes = 4 |
---|
25 | print 'output dir:', name |
---|
26 | |
---|
27 | var = [2,3] # depth and speed |
---|
28 | |
---|
29 | for which_var in var: |
---|
30 | if which_var == 0: # Stage |
---|
31 | outname = name + '_stage' |
---|
32 | quantityname = 'stage' |
---|
33 | |
---|
34 | if which_var == 1: # Absolute Momentum |
---|
35 | outname = name + '_momentum_i1' |
---|
36 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
37 | |
---|
38 | if which_var == 2: # Depth |
---|
39 | outname = name + '_depth' |
---|
40 | quantityname = 'stage-elevation' |
---|
41 | |
---|
42 | if which_var == 3: # Speed |
---|
43 | outname = name + '_speed' |
---|
44 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed |
---|
45 | |
---|
46 | if which_var == 4: # Elevation |
---|
47 | outname = name + '_elevation' |
---|
48 | quantityname = 'elevation' #Elevation |
---|
49 | |
---|
50 | if is_parallel == True: |
---|
51 | # print 'is_parallel',is_parallel |
---|
52 | for i in range(0,nodes): |
---|
53 | namei = name + '_P%d_%d' %(i,nodes) |
---|
54 | outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
55 | print 'start sww2dem for sww file %d' %(i) |
---|
56 | sww2dem(namei, basename_out = outnamei, |
---|
57 | quantity = quantityname, |
---|
58 | timestep = timestep, |
---|
59 | cellsize = cellsize, |
---|
60 | easting_min = project.e_min_area, |
---|
61 | easting_max = project.e_max_area, |
---|
62 | northing_min = project.n_min_area, |
---|
63 | northing_max = project.n_max_area, |
---|
64 | reduction = max, |
---|
65 | verbose = True, |
---|
66 | format = 'asc') |
---|
67 | else: |
---|
68 | print 'start sww2dem' |
---|
69 | sww2dem(name, basename_out = outname, |
---|
70 | quantity = quantityname, |
---|
71 | timestep = timestep, |
---|
72 | cellsize = cellsize, |
---|
73 | easting_min = project.e_min_area, |
---|
74 | easting_max = project.e_max_area, |
---|
75 | northing_min = project.n_min_area, |
---|
76 | northing_max = project.n_max_area, |
---|
77 | reduction = max, |
---|
78 | verbose = True, |
---|
79 | format = 'asc') |
---|