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