source: anuga_work/production/geraldton/export_results.py @ 6748

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