source: anuga_work/production/onslow_2006/export_results.py @ 5381

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

update scripts

File size: 4.2 KB
Line 
1import project_grad, os
2import sys
3
4from anuga.shallow_water.data_manager import sww2dem
5from os import sep
6
7#time_dir = '20070613_034754_run_final_1.5_dampier_nbartzis' # HAT 1 in Dampier 10000 yr
8#time_dir = '20070518_021050_run_final_0.0_nbartzis' # MSL 1 in Dampier 10000 yr
9#time_dir = '' # HAT 1 in Broome 10000 yr
10#time_dir = '' # MSL 1 in Broome 10000 yr
11#time_dir = '' # HAT 1 in Pt Hedland 10000 yr
12#time_dir = '' # MSL 1 in Pt Hedland 10000 yr
13#time_dir = '20070608_060316_run_final_1.5_onslow_nbartzis' # HAT 1 in Onslow 10000 yr
14#time_dir = '20070531_002753_run_final_0.0_onslow_nbartzis' # MSL 1 in Onslow 10000 yr
15#time_dir = '20070608_062811_run_final_1.5_exmouth_nbartzis' # HAT 1 in Exmouth 10000 yr
16#time_dir = '20070605_234905_run_final_0.0_exmouth_nbartzis' # MSL 1 in Exmouth 10000 yr
17#time_dir = '20060704_063005' # 2006 simulation HAT Mw9
18#time_dir = '20070619_042140_run_final_1.5_exmouth_nbartzis' # exmouth HAT longer time
19#time_dir = '20070904_235118_run_final_1.5_jsexton_exmouth_original' # revised model original data
20#time_dir = '20070905_052311_run_final_1.5_jsexton_exmouth_revised' # revised model original + survey data
21#time_dir = '20070906_061418_run_final_1.5_jsexton_exmouth_original' # refined again
22#time_dir = '20070907_055936_run_final_1.5_jsexton_exmouth_revised' # refined again
23time_dir = '20080526_043334_run_final_1.5_kvanputt_exmouth_revised' # New
24cellsize = 25
25#cellsize = 150
26timestep = None
27directory = project_grad.output_dir
28#name = directory + time_dir + sep + project_grad.scenario_name
29name = directory+time_dir+sep+project_grad.scenario_name
30#name = directory+time_dir+sep+'onslow_time_35760_0'
31#name = directory+time_dir+sep+'source'
32
33from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
34
35#elevgrid = directory+time_dir+sep+'onslow_elevation_town'
36
37#convert_dem_from_ascii2netcdf(elevgrid, use_cache=True, verbose=True)
38
39#dem2pts(elevgrid,run_up_elev=True,run_up_loc=True)
40
41is_parallel = False
42#is_parallel = True
43if is_parallel == True: nodes = 4
44print 'output dir:', name
45
46var = [2,3,4] # depth and speed
47#var = [2] # depth
48#var = [4]
49#var = [0]
50
51for which_var in var:
52    if which_var == 0:  # Stage
53        outname = name + '_stage'
54        quantityname = 'stage'
55
56    if which_var == 1:  # Absolute Momentum
57        outname = name + '_momentum'
58        quantityname = '(xmomentum**2 + ymomentum**2)**0.5' 
59
60    if which_var == 2:  # Depth
61        outname = name + '_depth'
62        quantityname = 'stage-elevation' 
63
64    if which_var == 3:  # Speed
65        outname = name + '_speed'
66        quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))'  #Speed
67
68    if which_var == 4:  # Elevation
69        outname = name + '_elevation'
70        quantityname = 'elevation'  #Elevation
71
72    if is_parallel == True:
73    #    print 'is_parallel',is_parallel
74        for i in range(0,nodes):
75            namei = name + '_P%d_%d' %(i,nodes)
76            outnamei = outname + '_P%d_%d' %(i,nodes)
77            print 'start sww2dem for sww file %d' %(i)
78            sww2dem(namei, basename_out = outnamei,
79                        quantity = quantityname,
80                        timestep = timestep,
81                        cellsize = cellsize,     
82                        easting_min = project_grad.e_min_area,
83                        easting_max = project_grad.e_max_area,
84                        northing_min = project_grad.n_min_area,
85                        northing_max = project_grad.n_max_area,       
86                        reduction = max, 
87                        verbose = True,
88                        format = 'asc')
89    else:
90        print 'start sww2dem'
91        sww2dem(name, basename_out = outname,
92                    quantity = quantityname,
93                    timestep = timestep,
94                    cellsize = cellsize,     
95                    #easting_min = project_grad.e_min_area,
96                    #easting_max = project_grad.e_max_area,
97                    #northing_min = project_grad.n_min_area,
98                    #northing_max = project_grad.n_max_area,       
99                    reduction = max, 
100                    verbose = True,
101                    format = 'asc')
102
Note: See TracBrowser for help on using the repository browser.