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

Last change on this file since 4672 was 4581, checked in by sexton, 18 years ago

minor updates for model interrogation

File size: 3.6 KB
Line 
1import project, 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 = '20070530_082920_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
15time_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
18cellsize = 25
19#cellsize = 150
20timestep = None
21directory = project.outputdir
22#name = directory + time_dir + sep + project.scenario_name
23name = directory+time_dir+sep+project.scenario_name
24#name = directory+time_dir+sep+'source'
25
26from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
27
28elevgrid = directory+time_dir+sep+'onslow_elevation_town'
29
30convert_dem_from_ascii2netcdf(elevgrid, use_cache=True, verbose=True)
31
32dem2pts(elevgrid,run_up_elev=True,run_up_loc=True)
33
34"""
35is_parallel = False
36#is_parallel = True
37if is_parallel == True: nodes = 4
38print 'output dir:', name
39
40#var = [2,3,4] # depth and speed
41#var = [2] # depth
42var = [0]
43
44for which_var in var:
45    if which_var == 0:  # Stage
46        outname = name + '_stage'
47        quantityname = 'stage'
48
49    if which_var == 1:  # Absolute Momentum
50        outname = name + '_momentum_i1'
51        quantityname = '(xmomentum**2 + ymomentum**2)**0.5' 
52
53    if which_var == 2:  # Depth
54        outname = name + '_depth'
55        quantityname = 'stage-elevation' 
56
57    if which_var == 3:  # Speed
58        outname = name + '_speed'
59        quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))'  #Speed
60
61    if which_var == 4:  # Elevation
62        outname = name + '_elevation'
63        quantityname = 'elevation'  #Elevation
64
65    if is_parallel == True:
66    #    print 'is_parallel',is_parallel
67        for i in range(0,nodes):
68            namei = name + '_P%d_%d' %(i,nodes)
69            outnamei = outname + '_P%d_%d' %(i,nodes)
70            print 'start sww2dem for sww file %d' %(i)
71            sww2dem(namei, basename_out = outnamei,
72                        quantity = quantityname,
73                        timestep = timestep,
74                        cellsize = cellsize,     
75                        easting_min = project.e_min_area,
76                        easting_max = project.e_max_area,
77                        northing_min = project.n_min_area,
78                        northing_max = project.n_max_area,       
79                        reduction = max,
80                        verbose = True,
81                        format = 'asc')
82    else:
83        print 'start sww2dem'
84        sww2dem(name, basename_out = outname,
85                    quantity = quantityname,
86                    timestep = timestep,
87                    cellsize = cellsize,     
88                    easting_min = project.e_min_area,
89                    easting_max = project.e_max_area,
90                    northing_min = project.n_min_area,
91                    northing_max = project.n_max_area,       
92                    reduction = max,
93                    verbose = True,
94                    format = 'asc')
95
96"""
Note: See TracBrowser for help on using the repository browser.