source: production/pt_hedland_2006/export_results.py @ 3340

Last change on this file since 3340 was 3291, checked in by sexton, 18 years ago

update export bounding box - too big before

File size: 2.5 KB
RevLine 
[3288]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 = '20060706_235036' #test with coarse grid
[3289]10#time_dir = '20060707_001859' #MSL DLI data
11#time_dir = '20060707_003301' #HAT DLI data
12#time_dir = '20060707_003424' #LAT DLI data
[3288]13directory = project.outputdir
14name = directory + time_dir +sep + 'source'
15
16
17#normal screen output is stored in 'outname'
18screen_output_name = directory + time_dir + sep + "export_output_elev.txt"
19screen_error_name = directory + time_dir + sep + "export_error_elev.txt"
20
21#print 'hello', name
22
23#used to catch screen output to file
[3291]24sys.stdout = Screen_Catcher(screen_output_name)
25sys.stderr = Screen_Catcher(screen_error_name)
[3288]26
27print 'output dir:', name
28#print 'Which variable do you want to export?'
29#which_var = int(raw_input('Stage = 0, Absolute Momentum = 1, Depth = 2, Speed = 3  '  ))
30which_var = 4
31#sys.stderr.write(sys.stdout.data)
32if which_var == 0:  # Stage
33    outname = name + '_stage'
34    quantityname = 'stage'
35
36if which_var == 1:  # Absolute Momentum
37    outname = name + '_momentum'
38    quantityname = '(xmomentum**2 + ymomentum**2)**0.5'  #Absolute momentum
39
40if which_var == 2:  # Depth
41    outname = name + '_depth'
42    quantityname = 'stage-elevation'  #Depth
43
44if which_var == 3:  # Speed
45    outname = name + '_speed'
46    #quantityname = '((xmomentum/(stage-elevation))**2 + (ymomentum/(stage-elevation))**2)**0.5'  #Speed
47    #quantityname = 'xmomentum/(stage-elevation)'  #Speed
48    quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-30)'  #Speed
49
50if which_var == 4:  # Elevation
51    outname = name + '_elevation'
52    quantityname = 'elevation'  #Elevation
53
54print 'start sww2dem'
55#sys.stderr.write(sys.stdout.data)
56sww2dem(name, basename_out = outname,
57            quantity = quantityname,
58            cellsize = 20,       # Trevor would like this at 25
59            # define region for viz purposes
60            easting_min = project.e_min_area,
61            easting_max = project.e_max_area,
62            northing_min = project.n_min_area,
63            northing_max = project.n_max_area,       
64            reduction = max, #this is because we want max quantityname
65            verbose = True,
66            format = 'asc')
67
68#sys.stderr.write(sys.stdout.data)
69
70#Check
71
72#data = read_ermapper_grid(name)
73#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.