[3615] | 1 | import project, os |
---|
| 2 | import sys |
---|
| 3 | |
---|
[3650] | 4 | from anuga.shallow_water.data_manager import sww2dem |
---|
[3661] | 5 | #from anuga.pyvolution.ermapper_grids import read_ermapper_grid |
---|
| 6 | from anuga.abstract_2d_finite_volumes.util import Screen_Catcher |
---|
[3615] | 7 | from os import sep |
---|
| 8 | |
---|
[3661] | 9 | time_dir = '20060922_024842' #MSL |
---|
[3615] | 10 | directory = project.outputdir |
---|
[3661] | 11 | name = directory + time_dir +sep + 'source' |
---|
[3615] | 12 | |
---|
[3661] | 13 | print 'output dir:', name |
---|
[3615] | 14 | #print 'Which variable do you want to export?' |
---|
| 15 | #which_var = int(raw_input('Stage = 0, Absolute Momentum = 1, Depth = 2, Speed = 3 ' )) |
---|
[3661] | 16 | which_var = 4 |
---|
| 17 | #sys.stderr.write(sys.stdout.data) |
---|
[3615] | 18 | if which_var == 0: # Stage |
---|
| 19 | outname = name + '_stage' |
---|
| 20 | quantityname = 'stage' |
---|
| 21 | |
---|
| 22 | if which_var == 1: # Absolute Momentum |
---|
| 23 | outname = name + '_momentum' |
---|
| 24 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' #Absolute momentum |
---|
| 25 | |
---|
| 26 | if which_var == 2: # Depth |
---|
| 27 | outname = name + '_depth' |
---|
| 28 | quantityname = 'stage-elevation' #Depth |
---|
| 29 | |
---|
| 30 | if which_var == 3: # Speed |
---|
| 31 | outname = name + '_speed' |
---|
| 32 | #quantityname = '((xmomentum/(stage-elevation))**2 + (ymomentum/(stage-elevation))**2)**0.5' #Speed |
---|
| 33 | #quantityname = 'xmomentum/(stage-elevation)' #Speed |
---|
| 34 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-30)' #Speed |
---|
| 35 | |
---|
| 36 | if which_var == 4: # Elevation |
---|
[3661] | 37 | outname = name + '_elevation_node3' |
---|
[3615] | 38 | quantityname = 'elevation' #Elevation |
---|
| 39 | |
---|
[3661] | 40 | print 'start sww2dem' |
---|
| 41 | #sys.stderr.write(sys.stdout.data) |
---|
[3615] | 42 | sww2dem(name, basename_out = outname, |
---|
| 43 | quantity = quantityname, |
---|
[3661] | 44 | cellsize = 25, # Trevor would like this at 25 |
---|
[3615] | 45 | # define region for viz purposes |
---|
| 46 | easting_min = project.e_min_area, |
---|
| 47 | easting_max = project.e_max_area, |
---|
| 48 | northing_min = project.n_min_area, |
---|
| 49 | northing_max = project.n_max_area, |
---|
| 50 | reduction = max, #this is because we want max quantityname |
---|
| 51 | verbose = True, |
---|
| 52 | format = 'asc') |
---|
[3661] | 53 | |
---|
| 54 | #sys.stderr.write(sys.stdout.data) |
---|
| 55 | |
---|
| 56 | #Check |
---|
| 57 | |
---|
| 58 | #data = read_ermapper_grid(name) |
---|
| 59 | #print 'Values from %s are in [%f, %f]' %(name, min(data.flat), max(data.flat)) |
---|