1 | import project, os |
---|
2 | |
---|
3 | from pyvolution.data_manager import sww2dem |
---|
4 | from pyvolution.ermapper_grids import read_ermapper_grid |
---|
5 | |
---|
6 | name = project.outputname |
---|
7 | |
---|
8 | #print 'Which variable do you want to export?' |
---|
9 | #which_var = int(raw_input('Stage = 0, Absolute Momentum = 1, Depth = 2, Speed = 3 ' )) |
---|
10 | which_var = 2 |
---|
11 | |
---|
12 | if which_var == 0: # Stage |
---|
13 | outname = name + '_stage' |
---|
14 | quantityname = 'stage' |
---|
15 | |
---|
16 | if which_var == 1: # Absolute Momentum |
---|
17 | outname = name + '_momentum' |
---|
18 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' #Absolute momentum |
---|
19 | |
---|
20 | if which_var == 2: # Depth |
---|
21 | outname = name + '_depth' |
---|
22 | quantityname = 'stage-elevation' #Depth |
---|
23 | |
---|
24 | if which_var == 3: # Speed |
---|
25 | outname = name + '_speed' |
---|
26 | #quantityname = '((xmomentum/(stage-elevation))**2 + (ymomentum/(stage-elevation))**2)**0.5' #Speed |
---|
27 | #quantityname = 'xmomentum/(stage-elevation)' #Speed |
---|
28 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-30)' #Speed |
---|
29 | |
---|
30 | |
---|
31 | sww2dem(name, basename_out = outname, |
---|
32 | quantity = quantityname, |
---|
33 | cellsize = 25, # Trevor would like this at 25 |
---|
34 | # define region for viz purposes |
---|
35 | easting_min = project.eminviz, |
---|
36 | easting_max = project.emaxviz, |
---|
37 | northing_min = project.nminviz, |
---|
38 | northing_max = project.nmaxviz, |
---|
39 | reduction = max, #this is because we want max quantityname |
---|
40 | verbose = True, |
---|
41 | format = 'asc') |
---|
42 | |
---|
43 | #Check |
---|
44 | |
---|
45 | #data = read_ermapper_grid(name) |
---|
46 | #print 'Values from %s are in [%f, %f]' %(name, min(data.flat), max(data.flat)) |
---|