source: anuga_work/production/busselton/export_results.py @ 5409

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