source: anuga_work/production/carnarvon/export_results.py @ 6594

Last change on this file since 6594 was 5793, checked in by kristy, 16 years ago
File size: 2.6 KB
Line 
1import project, os
2import sys
3
4from anuga.shallow_water.data_manager import sww2dem
5from os import sep
6from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
7
8
9#time_dir = '20080908_154507_run_final_0.0_polyline_alpha0.1_kvanputt'
10time_dir = '20080909_123144_run_final_0.0_polyline_alpha0.1_kvanputt'
11
12
13cellsize = 25
14#cellsize = 150
15timestep = 0
16directory = project.output_dir
17name = directory+sep+time_dir+sep+project.scenario_name
18
19is_parallel = False
20#is_parallel = True
21
22if is_parallel == True: nodes = 4
23print 'output dir:', name
24
25
26var = [0,4] 
27#var = [2,3] # depth and Speed
28#var = [2,3] # elevation, depth and Speed
29
30
31for which_var in var:
32    if which_var == 0:  # Stage
33        outname = name + '_stage'
34        quantityname = 'stage'
35
36    if which_var == 1:  # Absolute Momentum
37        outname = name + '_momentum'
38        quantityname = '(xmomentum**2 + ymomentum**2)**0.5' 
39
40    if which_var == 2:  # Depth
41        outname = name + '_depth'
42        quantityname = 'stage-elevation' 
43
44    if which_var == 3:  # Speed
45        outname = name + '_speed'
46        quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))'  #Speed
47
48    if which_var == 4:  # Elevation
49        outname = name + '_elevation'
50        quantityname = 'elevation'  #Elevation
51
52    if is_parallel == True:
53    #    print 'is_parallel',is_parallel
54        for i in range(0,nodes):
55            namei = name + '_P%d_%d' %(i,nodes)
56            outnamei = outname + '_P%d_%d' %(i,nodes)
57            print 'start sww2dem for sww file %d' %(i)
58            sww2dem(namei, basename_out = outnamei,
59                        quantity = quantityname,
60                        #timestep = timestep,
61                        cellsize = cellsize,     
62                        easting_min = project_grad.e_min_area,
63                        easting_max = project_grad.e_max_area,
64                        northing_min = project_grad.n_min_area,
65                        northing_max = project_grad.n_max_area,       
66                        reduction = max, 
67                        verbose = True,
68                        format = 'asc')
69    else:
70        print 'start sww2dem'
71        sww2dem(name, basename_out = outname,
72                    quantity = quantityname,
73                    timestep = timestep,
74                    cellsize = cellsize,
75                    number_of_decimal_places = 4,
76                    reduction = max, 
77                    verbose = True,
78                    format = 'asc')
79
Note: See TracBrowser for help on using the repository browser.