source: anuga_work/production/perth/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
RevLine 
[5409]1import project, os
2import sys
3
4from anuga.shallow_water.data_manager import sww2dem
5from os import sep
6
7#time_dir = '20080526_104946_run_final_0.6_test_kvanputt'
8time_dir = '20080530_170833_run_final_0.6_exmouth_kvanputt'
9
10
11cellsize = 25
12#cellsize = 150
13#timestep = 0
14directory = project.output_dir
15name = directory+time_dir+sep+project.scenario_name
16
17from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
18
19
20is_parallel = False
21#is_parallel = True
22
23if is_parallel == True: nodes = 4
24print 'output dir:', name
25
26var = [2,3,4] # depth and speed
27#var = [2] # depth
28#var = [4]
29#var = [2] #depth
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                    #easting_min = project_grad.e_min_area,
76                    #easting_max = project_grad.e_max_area,
77                    #northing_min = project_grad.n_min_area,
78                    #northing_max = project_grad.n_max_area,       
79                    reduction = max, 
80                    verbose = True,
81                    format = 'asc')
82
Note: See TracBrowser for help on using the repository browser.