source: anuga_work/production/perth/export_results.py @ 5498

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