source: production/onslow_2006/export_results.py @ 3514

Last change on this file since 3514 was 3514, checked in by duncan, 18 years ago

Hi all,
I'm doing a change in the anuga structure, moving the code to

\anuga_core\source\anuga

After you have done an svn update, the PYTHONPATH has to be changed to;
PYTHONPATH = anuga_core/source/

This is part of changes required to make installation of anuga quicker and reducing the size of our sandpits.

If any imports are broken, try fixing them. With adding anuga. to them for example. If this seems to have really broken things, email/phone me.

Cheers
Duncan

File size: 2.7 KB
Line 
1import project, os
2import sys
3
4from anuga.pyvolution.data_manager import sww2dem
5from anuga.pyvolution.ermapper_grids import read_ermapper_grid
6from anuga.pyvolution.util import Screen_Catcher
7from os import sep
8
9#time_dir = '20060704_063005' #HAT
10time_dir = '20060706_235246' #LAT
11#time_dir = '20060704_063234' #MSL
12#time_dir = '20060515_001733' #DTED data
13directory = project.outputdir
14name = directory + time_dir +sep + 'source'
15# to develop grid of MOST output
16#directory = project.boundarydir
17#name = directory + project.boundary_basename
18
19#normal screen output is stored in 'outname'
20#screen_output_name = directory + time_dir + sep + "export_output.txt"
21#screen_error_name = directory + time_dir + sep + "export_error.txt"
22# for MOST output
23#screen_output_name = directory  +  "export_output.txt"
24#screen_error_name = directory +  "export_error.txt"
25
26#used to catch screen output to file
27sys.stdout = Screen_Catcher(screen_output_name)
28sys.stderr = Screen_Catcher(screen_error_name)
29
30print 'output dir:', name
31#print 'Which variable do you want to export?'
32#which_var = int(raw_input('Stage = 0, Absolute Momentum = 1, Depth = 2, Speed = 3  '  ))
33which_var = 4
34#sys.stderr.write(sys.stdout.data)
35if which_var == 0:  # Stage
36    outname = name + '_stage'
37    quantityname = 'stage'
38
39if which_var == 1:  # Absolute Momentum
40    outname = name + '_momentum'
41    quantityname = '(xmomentum**2 + ymomentum**2)**0.5'  #Absolute momentum
42
43if which_var == 2:  # Depth
44    outname = name + '_depth'
45    quantityname = 'stage-elevation'  #Depth
46
47if which_var == 3:  # Speed
48    outname = name + '_speed'
49    #quantityname = '((xmomentum/(stage-elevation))**2 + (ymomentum/(stage-elevation))**2)**0.5'  #Speed
50    #quantityname = 'xmomentum/(stage-elevation)'  #Speed
51    quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-30)'  #Speed
52
53if which_var == 4:  # Elevation
54    outname = name + '_elevation'
55    quantityname = 'elevation'  #Elevation
56
57print 'start sww2dem'
58#sys.stderr.write(sys.stdout.data)
59sww2dem(name, basename_out = outname,
60            quantity = quantityname,
61            cellsize = 20,       # Trevor would like this at 25
62            # define region for viz purposes
63            easting_min = project.e_min_area,
64            easting_max = project.e_max_area,
65            northing_min = project.n_min_area,
66            northing_max = project.n_max_area,       
67            reduction = max, #this is because we want max quantityname
68            verbose = True,
69            format = 'asc')
70
71#sys.stderr.write(sys.stdout.data)
72
73#Check
74
75#data = read_ermapper_grid(name)
76#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.