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

Last change on this file since 5669 was 5669, checked in by kristy, 16 years ago

Updated

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