source: anuga_work/production/carnarvon/export_results_multiple_timesteps.py @ 6513

Last change on this file since 6513 was 6513, checked in by myall, 14 years ago

made export script that loops - to get multiple timesteps in one run

File size: 3.3 KB
Line 
1import project, 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
9#time_dir = '20080908_154507_run_final_0.0_polyline_alpha0.1_kvanputt'
10#time_dir = '20080909_123144_run_final_0.0_polyline_alpha0.1_kvanputt'
11
12time_dir1 = '20081202_084202_run_final_1_27255_alpha0.1_kvanputt'
13time_dir2 = '20081202_083932_run_final_0_27255_alpha0.1_kvanputt'
14
15time_dirs = [time_dir1,time_dir2]
16
17cellsize = 250
18#cellsize = 150
19timestep_list = range(53000,67000,1020)
20directory = project.output_dir
21
22is_parallel = False
23#is_parallel = True
24
25if is_parallel == True: nodes = 4
26
27
28
29var = [0,2,3] 
30#var = [2,3] # depth and Speed
31#var = [2,3] # elevation, depth and Speed
32
33for time_dir in time_dirs:
34    name = directory+sep+time_dir+sep+project.scenario_name
35    print 'output dir:', name
36   
37    for 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        for timestep in timestep_list:
59            outname_time = outname + '_' + str(timestep)
60            print 'output filename', outname_time
61            print 'time = ',timestep
62            if is_parallel == True:
63                print 'is_parallel',is_parallel
64    ##            for i in range(0,nodes):
65    ##                namei = name + '_P%d_%d' %(i,nodes)
66    ##                outnamei = outname + '_P%d_%d' %(i,nodes)
67    ##                print 'start sww2dem for sww file %d' %(i)
68    ##                sww2dem(namei, basename_out = outnamei,
69    ##                            quantity = quantityname,
70    ##                            #timestep = timestep,
71    ##                            cellsize = cellsize,     
72    ##                            easting_min = project_grad.e_min_area,
73    ##                            easting_max = project_grad.e_max_area,
74    ##                            northing_min = project_grad.n_min_area,
75    ##                            northing_max = project_grad.n_max_area,       
76    ##                            reduction = max,
77    ##                            verbose = True,
78    ##                            format = 'asc')
79            else:
80                print 'start sww2dem'
81                sww2dem(name, basename_out = outname_time,
82                            quantity = quantityname,
83                            timestep = timestep,
84                            cellsize = cellsize,
85                            number_of_decimal_places = 4,
86                            reduction = max, 
87                            verbose = True,
88                            format = 'asc')
89
90
Note: See TracBrowser for help on using the repository browser.