source: production/onslow_2006/export_results.py @ 2706

Last change on this file since 2706 was 2706, checked in by nick, 18 years ago

updates to onslow

File size: 2.3 KB
Line 
1import project, os
2import sys
3
4from pyvolution.data_manager import sww2dem
5from pyvolution.ermapper_grids import read_ermapper_grid
6from pyvolution.util import Screen_Catcher
7from os import sep
8
9time_dir = "20060327_095435"
10directory = project.outputdir
11name = directory + time_dir +sep + "source"
12
13#normal screen output is stored in 'outname'
14screen_output_name = directory + time_dir + sep + "export_output.txt"
15
16#used to catch screen output to file
17sys.stdout = Screen_Catcher(screen_output_name)
18sys.stderr = Screen_Catcher(screen_output_name)
19
20print '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  '  ))
23which_var = 4
24sys.stderr.write(sys.stdout.data)
25if which_var == 0:  # Stage
26    outname = name + '_stage'
27    quantityname = 'stage'
28
29if which_var == 1:  # Absolute Momentum
30    outname = name + '_momentum'
31    quantityname = '(xmomentum**2 + ymomentum**2)**0.5'  #Absolute momentum
32
33if which_var == 2:  # Depth
34    outname = name + '_depth'
35    quantityname = 'stage-elevation'  #Depth
36
37if which_var == 3:  # Speed
38    outname = name + '_speed'
39    #quantityname = '((xmomentum/(stage-elevation))**2 + (ymomentum/(stage-elevation))**2)**0.5'  #Speed
40    #quantityname = 'xmomentum/(stage-elevation)'  #Speed
41    quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-30)'  #Speed
42
43if which_var == 4:  # Elevation
44    outname = name + '_elevation'
45    quantityname = 'elevation'  #Elevation
46
47print 'start sww2dem'
48sys.stderr.write(sys.stdout.data)
49sww2dem(name, basename_out = outname,
50            quantity = quantityname,
51            cellsize = 1000,       # Trevor would like this at 25
52            # define region for viz purposes
53            easting_min = project.e_min_area,
54            easting_max = project.e_max_area,
55            northing_min = project.n_min_area,
56            northing_max = project.n_max_area,       
57            reduction = max, #this is because we want max quantityname
58            verbose = True,
59            format = 'asc')
60
61sys.stderr.write(sys.stdout.data)
62
63#Check
64
65#data = read_ermapper_grid(name)
66#print 'Values from %s are in [%f, %f]' %(name, min(data.flat), max(data.flat))
Note: See TracBrowser for help on using the repository browser.