1 | import project, os |
---|
2 | import sys |
---|
3 | |
---|
4 | from anuga.shallow_water.data_manager import sww2dem |
---|
5 | from anuga.abstract_2d_finite_volumes.util import Screen_Catcher |
---|
6 | from os import sep |
---|
7 | |
---|
8 | # OLE - this is the smallest sww file with the complex bounding polygon |
---|
9 | time_dir = '20060928_073318' #alpha = 0.5 |
---|
10 | |
---|
11 | #time_dir = '20060928_064732' #alpha = 0.01 |
---|
12 | #time_dir = '20060928_220905' #alpha = 1.0 |
---|
13 | #time_dir = '20060926_064750' #this worked for cellsize 30 and 100 |
---|
14 | #time_dir = '20060929_033100' #alpha = 0.01 poly anticlockwise - DIDN'T WORK |
---|
15 | #time_dir = '20060929_075954' #alpha = 0.1 grid with MOST |
---|
16 | #time_dir = '20060929_075009' #alpha = 0.1 points with MOST |
---|
17 | directory = project.outputdir |
---|
18 | name = directory + time_dir +sep + 'source' |
---|
19 | |
---|
20 | print 'output dir:', name |
---|
21 | #print 'Which variable do you want to export?' |
---|
22 | #which_var = int(raw_input('Stage = 0, Absolute Momentum = 1, Depth = 2, Speed = 3 ' )) |
---|
23 | which_var = 4 |
---|
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' |
---|
30 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' #Absolute momentum |
---|
31 | |
---|
32 | if which_var == 2: # Depth |
---|
33 | outname = name + '_depth' |
---|
34 | quantityname = 'stage-elevation' #Depth |
---|
35 | |
---|
36 | if which_var == 3: # Speed |
---|
37 | outname = name + '_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_2' |
---|
42 | quantityname = 'elevation' #Elevation |
---|
43 | |
---|
44 | print 'start sww2dem' |
---|
45 | sww2dem(name, basename_out = outname, |
---|
46 | quantity = quantityname, |
---|
47 | cellsize = 500, # would prefer this at 25 |
---|
48 | # define region for viz purposes |
---|
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, #this is because we want max quantityname |
---|
54 | verbose = True, |
---|
55 | format = 'asc') |
---|
56 | |
---|