Changeset 3271
- Timestamp:
- Jul 4, 2006, 11:04:04 AM (19 years ago)
- Location:
- production/pt_hedland_2006
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
production/pt_hedland_2006/get_building_inundation.py
r2896 r3271 29 29 30 30 # Inputs 31 #timestampdir = '' # MSL 31 32 #timestampdir = '' # HAT 32 33 timestampdir = '' # LAT -
production/pt_hedland_2006/project.py
r3190 r3271 10 10 from coordinate_transforms.redfearn import degminsec2decimal_degrees 11 11 from time import localtime, strftime 12 13 12 from geospatial_data import * 14 13 15 16 17 18 14 #Making assumptions about the location of scenario data 15 state = 'western_australia' 19 16 scenario_dir_name = 'pt_hedland_tsunami_scenario_2006' 20 17 21 18 # onshore data from 30m DTED level 2 22 onshore_name = 'pt_hedland_onshore_30m_dted' # get from Neil/Ingo (DEM or topo data) 19 onshore_name_dted = 'pt_hedland_onshore_30m_dted' # get from Neil/Ingo (DEM or topo data) 20 onshore_name_dli = 'pt_hedland_onshore_20m_dli' # get from Neil/Ingo (DEM or topo data) 21 23 22 # offshore data from GA digitised charts 24 23 offshore_name1 = 'pt_hedland_offshore_points' 24 25 25 # offshore data from AHO fairsheets 26 26 offshore_name2 = 'pt_hedland_offshore_points_fairsheet' 27 27 28 # coastline developed from 30m DTED 28 29 coast_name = 'pt_hedland_coastline_points.xya' … … 36 37 37 38 if sys.platform == 'win32': 38 home = getenv('INUNDATIONHOME') 39 home = getenv('INUNDATIONHOME') #Sandpit's parent dir 39 40 # python_home = getenv('PWD') 40 # home = environ['INUNDATIONHOME'] #Sandpit's parent dir41 41 #user = basename(getenv('USERPROFILE')) 42 42 #print 'USER:', user 43 else: 44 home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation') 43 else: 44 # original 45 #home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation') 46 # update to perlite 2 47 home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'2'+sep+'cit'+sep+'inundation'+sep+'data') 45 48 user = getenv('LOGNAME') 46 49 print 'USER:', user … … 48 51 #Derive subdirectories and filenames 49 52 time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir 50 #print 'home', home 51 outputtimedir = home+sep+scenario_dir_name+sep+'output'+sep+time+sep 53 outputtimedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep+time+sep 54 52 55 #print 'outputtimedir', outputtimedir 53 meshdir = home+sep+scenario_dir_name+sep+'meshes'+sep 54 datadir = home+sep+scenario_dir_name+sep+'topographies'+sep 55 gaugedir = home+sep+scenario_dir_name+sep+'gauges'+sep 56 polygondir = home+sep+scenario_dir_name+sep+'polygons'+sep 57 boundarydir = home+sep+scenario_dir_name+sep+'boundaries'+sep 58 #output dir without time 59 outputdir = home+sep+scenario_dir_name+sep+'output'+sep 60 tidedir = home+sep+scenario_dir_name+sep+'tide_data'+sep 56 #meshdir = home+sep+scenario_dir_name+sep+'meshes'+sep 57 #datadir = home+sep+scenario_dir_name+sep+'topographies'+sep 58 #gaugedir = home+sep+scenario_dir_name+sep+'gauges'+sep 59 #polygondir = home+sep+scenario_dir_name+sep+'polygons'+sep 60 #boundarydir = home+sep+scenario_dir_name+sep+'boundaries'+sep 61 #outputdir = home+sep+scenario_dir_name+sep+'outputs'+sep 62 #tidedir = home+sep+scenario_dir_name+sep+'tide_data'+sep 61 63 62 #print'bound', boundarydir 64 meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep 65 datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep 66 gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep 67 polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep 68 boundarydir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep 69 outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep 70 tidedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'tide_data'+sep 63 71 64 #gauge_filename = gaugedir + 'onslow_gauges.xya'65 #for MOST66 #gauge_filename = gaugedir + 'pt_hedland_gauges.xya'67 72 gauge_filename = gaugedir + 'gauge_location_port_hedland.csv' 68 73 buildings_filename = gaugedir + 'pt_hedland_res.csv' … … 72 77 coast_filename = datadir + coast_name 73 78 74 # boundary source data75 #MOST_dir = 'f:'+sep+'3'+sep+'ehn'+sep+'users'+sep+'davidb'+sep+'tsunami'+sep+'WA_project'+sep+'SU-AU_90'+sep+'most_2'+sep+'detailed'+sep76 77 #print 'name', __name__78 #print 'path', __file__79 #codedir = getcwd()+sep80 81 #project_code_name = __name__82 83 #project_code_dir_name = __file__84 85 79 meshname = meshdir + basename 86 87 onshore_dem_name = datadir + onshore_name 88 80 onshore_dem_name = datadir + onshore_name_dted 89 81 offshore_dem_name1 = datadir + offshore_name1 90 82 offshore_dem_name2 = datadir + offshore_name2 91 92 83 combined_dem_name = datadir + 'pt_hedland_combined_elevation' 93 94 84 outputname = outputtimedir + basename #Used by post processing 95 85 … … 107 97 108 98 # region to export (used from export_results.py) 109 110 99 e_min_area = 633000 111 100 e_max_area = 690000 … … 113 102 n_max_area = 7761000 114 103 115 refzone = 50 # confirm with Hamish104 refzone = 50 116 105 117 106 # bounding polygon provided by Hamish … … 155 144 156 145 poly_region = [j0, j1, j2, j3] 157 158 coast_buffer_file = datadir+'pts2ascii_test.xya'159 G = Geospatial_data(file_name=coast_buffer_file,delimiter=' ')160 poly_coast = list(G.get_data_points())161 #print 'get_data_points()',G.get_data_points()162 #print 'get_',poly_region163 164 165 -
production/pt_hedland_2006/run_pt_hedland.py
r3251 r3271 1 """Script for running a tsunami inundation scenario for Port Hedland, WA, Australia.1 """Script for running a tsunami inundation scenario for Onslow, WA, Australia. 2 2 3 3 Source data such as elevation and boundary data is assumed to be available in … … 5 5 The output sww file is stored in project.outputtimedir 6 6 7 The scenario is defined by a triangular mesh created from project.polygon and8 the elevation data .9 10 Ole Nielsen and Duncan Gray, GA - 2005 , Nick Bartzis and Jane Sexton, GA - 20067 The scenario is defined by a triangular mesh created from project.polygon, 8 the elevation data and a simulated submarine landslide. 9 10 Ole Nielsen and Duncan Gray, GA - 2005 and Nick Bartzis, GA - 2006 11 11 """ 12 13 14 #------------------------------------------------------------------------------ 15 # Import necessary modules 16 #------------------------------------------------------------------------------ 12 #-------------------------------------------------------------------------------# Import necessary modules 13 #------------------------------------------------------------------------------- 17 14 18 15 # Standard modules 19 import os20 21 16 from os import sep 22 17 from os.path import dirname, basename 23 24 18 import time 25 19 … … 30 24 from pyvolution.combine_pts import combine_rectangular_points_files 31 25 from pyvolution.pmesh2domain import pmesh_to_domain_instance 32 #from geospatial_data import add_points_files33 34 # Application specific imports35 import project # Definition of file names and polygons36 from smf import slump_tsunami # Function for submarine mudslide37 38 26 from shutil import copy 39 27 from os import mkdir, access, F_OK 40 41 28 from geospatial_data import * 42 29 import sys 43 30 from pyvolution.util import Screen_Catcher 44 31 45 #------------------------------------------------------------------------------ 32 # Application specific imports 33 import project # Definition of file names and polygons 34 35 36 #------------------------------------------------------------------------------- 46 37 # Preparation of topographic data 47 38 # … … 49 40 # Do for coarse and fine data 50 41 # Fine pts file to be clipped to area of interest 51 #------------------------------------------------------------------------------ 42 #------------------------------------------------------------------------------- 52 43 53 44 # filenames … … 58 49 source_dir = project.boundarydir 59 50 60 61 62 63 #import sys; sys.exit() 64 65 # creates copy of code in output dir if dir doesn't exist 51 ## creates copy of code in output dir if dir doesn't exist 66 52 if access(project.outputtimedir,F_OK) == 0 : 67 53 mkdir (project.outputtimedir) … … 69 55 copy (__file__, project.outputtimedir + basename(__file__)) 70 56 71 72 #normal screen output is stored in 57 print 'project.outputtimedir',project.outputtimedir 58 59 ##normal screen output is stored in 73 60 screen_output_name = project.outputtimedir + "screen_output.txt" 74 61 screen_error_name = project.outputtimedir + "screen_error.txt" 75 62 76 63 #used to catch screen output to file 77 #sys.stdout = Screen_Catcher(screen_output_name) 78 #sys.stderr = Screen_Catcher(screen_error_name) 79 80 81 ''' 64 sys.stdout = Screen_Catcher(screen_output_name) 65 sys.stderr = Screen_Catcher(screen_error_name) 66 82 67 # fine data (clipping the points file to smaller area) 83 68 # creates DEM from asc data … … 90 75 northing_min=project.northingmin, 91 76 northing_max= project.northingmax, 92 use_cache=True, 77 use_cache=True, 93 78 verbose=True) 94 79 95 print 'create G1'80 print 'create G1' 96 81 G1 = Geospatial_data(file_name = project.offshore_dem_name1 + '.xya') 97 82 98 print 'create G2'83 print 'create G2' 99 84 G2 = Geospatial_data(file_name = project.offshore_dem_name2 + '.xya') 100 85 101 print 'create G3'86 print 'create G3' 102 87 G3 = Geospatial_data(file_name = project.onshore_dem_name + '.pts') 103 88 104 print 'add G1+G2+G3'89 print 'add G1+G2+G3' 105 90 G = G1 + G2 + G3 106 91 107 print 'export G'92 print 'export G' 108 93 G.export_points_file(project.combined_dem_name + '.pts') 109 94 110 ''' 111 #------------------------------------------------------------------------------ 95 96 #------------------------------------------------------------------------------- 112 97 # Create the triangular mesh based on overall clipping polygon with a tagged 113 98 # boundary and interior regions defined in project.py along with 114 99 # resolutions (maximal area of per triangle) for each polygon 115 #------------------------------------------------------------------------------ 100 #------------------------------------------------------------------------------- 116 101 117 102 from pmesh.mesh_interface import create_mesh_from_regions 118 103 119 104 region_res = 100000 120 coast_res = 2500 121 pt_hedland_res = 500 105 coast_res = 25000 106 pt_hedland_res = 5000 122 107 # derive poly_coast from project.coast_name using alpha_shape 108 #interior_regions = [[project.poly_pt_hedland, pt_hedland_res], 123 109 interior_regions = [[project.poly_pt_hedland, pt_hedland_res], 124 [project.poly_coast, coast_res]] 125 # [project.poly_region, region_res]] 110 [project.poly_region, region_res]] 126 111 127 112 print 'number of interior regions', len(interior_regions) … … 139 124 count += 1 140 125 141 figname = 'pt_hedland_polys' 142 print'pt_hedland_polys'143 #plot_polygons([project.polyAll, project.poly_pt_hedland, project.poly_region], 144 plot_polygons([project.poly_coast],126 if sys.platform == 'win32': 127 #figname = project.outputtimedir + 'pt_hedland_polys' 128 figname = 'pt_hedland_polys' 129 plot_polygons([project.polyAll,project.poly_pt_hedland,project.poly_region], 145 130 figname, 146 verbose = True) 131 verbose = True) 147 132 148 133 if count == 0: … … 152 137 print 'check %s in production directory' %figname 153 138 import sys; sys.exit() 154 139 155 140 print 'start create mesh from regions' 156 141 from caching import cache 157 142 _ = cache(create_mesh_from_regions, 158 143 project.polyAll, 144 # project.poly_region, 159 145 # {'boundary_tags': {'right': [0], 'bottomright': [1], 160 146 # 'bottomleft': [2], 'left': [3], 'top': [4]}, 161 {'boundary_tags': {'topright': [0], 'top': [1],'topleft': [2], 'left': [3], 162 'bottomleft': [4], 'bottomright': [5], 'right': [6]}, 163 'maximum_triangle_area': 10000000, 147 # {'boundary_tags': {'topright': [0], 'top': [1],'topleft': [2], 'left': [3], 148 # 'bottomleft': [4], 'bottomright': [5], 'right': [6]}, 149 {'boundary_tags': {'topright': [0],'topleft': [1], 'left': [2], 150 'bottomleft': [3], 'bottomright': [4], 'right': [5]}, 151 'maximum_triangle_area': 500000, 164 152 'filename': meshname, 165 153 'interior_regions': interior_regions}, 166 verbose = True )167 168 169 #------------------------------------------------------------------------------ 154 verbose = True, evaluate=True) 155 156 157 #------------------------------------------------------------------------------- 170 158 # Setup computational domain 171 #------------------------------------------------------------------------------ 172 173 ''' 174 domain = pmesh_to_domain_instance(meshname, Domain, 175 use_cache = False, 176 verbose = True) 177 ''' 178 159 #------------------------------------------------------------------------------- 179 160 domain = Domain(meshname, use_cache = False, verbose = True) 180 161 162 print domain.statistics() 181 163 print 'Number of triangles = ', len(domain) 182 164 print 'The extent is ', domain.get_extent() … … 187 169 domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum']) 188 170 189 #------------------------------------------------------------------------------ 171 #------------------------------------------------------------------------------- 190 172 # Setup initial conditions 191 #------------------------------------------------------------------------------ 173 #------------------------------------------------------------------------------- 192 174 193 175 tide = 0. 176 #high 177 #tide = 3.6 178 #low 179 #tide = -3.9 194 180 195 181 domain.set_quantity('stage', tide) … … 204 190 ) 205 191 206 #print 'have sent quantities OK - now exiting' 207 #import sys; sys.exit() 208 209 #------------------------------------------------------------------------------ 192 #------------------------------------------------------------------------------- 210 193 # Setup boundary conditions (all reflective) 211 #------------------------------------------------------------------------------ 194 #------------------------------------------------------------------------------- 212 195 print 'start ferret2sww' 213 196 # skipped as results in file SU-AU_clipped is correct for all WA … … 235 218 'fail_on_NaN': False, 236 219 'inverted_bathymetry': True}, 237 #evaluate = True, 238 verbose = True, 239 dependencies= source_dir + project.boundary_basename + '.sww') 220 evaluate = True, 221 verbose = True,) 240 222 241 223 … … 247 229 Bd = Dirichlet_boundary([tide,0,0]) 248 230 249 # 7 min square wave starting at 1 min, 6m high 250 Bw = Time_boundary(domain = domain, 251 f=lambda t: [(60<t<480)*6, 0, 0]) 252 253 #domain.set_boundary( {'top': Bf, 'left': Br, 'bottomleft': Br, 'bottomright': Br, 'right': Br} ) 254 # 255 domain.set_boundary( {'topright': Bf, 'top': Bf,'topleft': Bf, 'left': Br, 256 'bottomleft': Br, 'bottomright': Br, 'right': Br}) 231 domain.set_boundary( {'topright': Bf,'topleft': Bf, 'left': Bd, 232 'bottomleft': Bd, 'bottomright': Bd, 'right': Bd}) 257 233 258 #------------------------------------------------------------------------------ 234 #------------------------------------------------------------------------------- 259 235 # Evolve system through time 260 #------------------------------------------------------------------------------ 236 #------------------------------------------------------------------------------- 261 237 import time 262 238 t0 = time.time() 263 239 264 for t in domain.evolve(yieldstep = 240, finaltime = 7200):265 domain.write_time() 266 domain.write_boundary_statistics(tags = 'top ')267 268 for t in domain.evolve(yieldstep = 120, finaltime = 1 2600269 ,skip_initial_step = True): 270 domain.write_time() 271 domain.write_boundary_statistics(tags = 'top ')272 273 for t in domain.evolve(yieldstep = 60, finaltime = 19800274 ,skip_initial_step = True): 275 domain.write_time() 276 domain.write_boundary_statistics(tags = 'top ')240 for t in domain.evolve(yieldstep = 240, finaltime = 12240): 241 domain.write_time() 242 domain.write_boundary_statistics(tags = 'topleft') 243 244 for t in domain.evolve(yieldstep = 120, finaltime = 15600 245 ,skip_initial_step = True): 246 domain.write_time() 247 domain.write_boundary_statistics(tags = 'topleft') 248 249 for t in domain.evolve(yieldstep = 60, finaltime = 22020 250 ,skip_initial_step = True): 251 domain.write_time() 252 domain.write_boundary_statistics(tags = 'topleft') 277 253 278 for t in domain.evolve(yieldstep = 120, finaltime = 2 5200279 ,skip_initial_step = True): 280 domain.write_time() 281 domain.write_boundary_statistics(tags = 'top ')254 for t in domain.evolve(yieldstep = 120, finaltime = 27060 255 ,skip_initial_step = True): 256 domain.write_time() 257 domain.write_boundary_statistics(tags = 'topleft') 282 258 283 259 for t in domain.evolve(yieldstep = 240, finaltime = 36000 284 260 ,skip_initial_step = True): 285 261 domain.write_time() 286 domain.write_boundary_statistics(tags = 'top ')262 domain.write_boundary_statistics(tags = 'topleft') 287 263 288 264 print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracChangeset
for help on using the changeset viewer.