source: anuga_work/production/pt_hedland_2008/export_results.py @ 5836

Last change on this file since 5836 was 5836, checked in by jgriffin, 15 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 = '20081014_163150_run_final_0_27283_alpha0.1_jgriffin'
8
9cellsize = 30
10#cellsize = 150
11#timestep = 0
12directory = project.output_dir
13name = directory+time_dir+sep+project.scenario_name
14
15from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
16
17
18is_parallel = False
19#is_parallel = True
20
21if is_parallel == True: nodes = 4
22print 'output dir:', name
23
24#var = [3,4] # depth and speed
25#var = [2] # depth
26var = [4] # stage and elevation
27
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                    #easting_min = project_grad.e_min_area,
74                    #easting_max = project_grad.e_max_area,
75                    #northing_min = project_grad.n_min_area,
76                    #northing_max = project_grad.n_max_area,       
77                    reduction = max, 
78                    verbose = True,
79                    format = 'asc')
80
Note: See TracBrowser for help on using the repository browser.