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