Changeset 2902
- Timestamp:
- May 18, 2006, 10:01:58 AM (19 years ago)
- Location:
- production
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
production/onslow_2006/export_results.py
r2773 r2902 7 7 from os import sep 8 8 9 time_dir = "200604 19_071046"9 time_dir = "20060426_004517" 10 10 directory = project.outputdir 11 11 name = directory + time_dir +sep + "source" -
production/onslow_2006/project.py
r2863 r2902 3 3 """ 4 4 5 from os import sep, environ 5 from os import sep, environ, getenv, getcwd 6 6 from os.path import expanduser 7 7 from utilities.polygon import read_polygon … … 14 14 from time import localtime, strftime 15 15 16 from os import getcwd17 16 18 17 #Making assumptions about the location of scenario data … … 36 35 if sys.platform == 'win32': 37 36 home = environ['INUNDATIONHOME'] #Sandpit's parent dir 37 # home = environ['INUNDATIONHOME'] #Sandpit's parent dir 38 38 else: 39 home = environ['INUNDATIONHOME'] #Sandpit's parent dir 40 # home = expanduser('~') 39 home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation') 41 40 42 41 #Derive subdirectories and filenames -
production/onslow_2006/run_onslow.py
r2863 r2902 131 131 ''' 132 132 #new 133 region_res = 25000133 region_res = 50000 134 134 coast_res = 2500 135 135 onslow_res = 500 … … 147 147 'bottom': [4], 'bottomright': [5], 148 148 'topright':[6]}, 149 'maximum_triangle_area': 100000,149 'maximum_triangle_area': 200000, 150 150 'filename': meshname, 151 151 'interior_regions': interior_regions}, -
production/pt_hedland_2006/project.py
r2855 r2902 3 3 """ 4 4 5 from os import sep, environ 5 from os import sep, environ, getenv, getcwd 6 6 from os.path import expanduser 7 7 from utilities.polygon import read_polygon … … 10 10 from coordinate_transforms.redfearn import degminsec2decimal_degrees 11 11 from time import localtime, strftime 12 from os import getcwd13 12 14 13 #Making assumptions about the location of scenario data … … 32 31 33 32 if sys.platform == 'win32': 34 home = environ['INUNDATIONHOME'] #Sandpit's parent dir 33 home = getenv('INUNDATIONHOME') 34 # python_home = getenv('PWD') 35 # home = environ['INUNDATIONHOME'] #Sandpit's parent dir 35 36 else: 36 home = expanduser('~') 37 # home = environ['INUNDATIONHOME'] #Sandpit's parent dir 38 # home = getenv('INUNDATIONHOME') 39 # python_home = getenv('PWD') 40 home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation') 41 # home = sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation' 42 # home = expanduser('~') 37 43 38 44 #Derive subdirectories and filenames 39 45 time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir 46 #print 'home', home 40 47 outputtimedir = home+sep+scenario_dir_name+sep+'output'+sep+time+sep 48 #print 'outputtimedir', outputtimedir 41 49 meshdir = home+sep+scenario_dir_name+sep+'meshes'+sep 42 50 datadir = home+sep+scenario_dir_name+sep+'topographies'+sep … … 48 56 tidedir = home+sep+scenario_dir_name+sep+'tide_data'+sep 49 57 50 print'bound', boundarydir58 #print'bound', boundarydir 51 59 52 60 #gauge_filename = gaugedir + 'onslow_gauges.xya' … … 59 67 #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'+sep 60 68 61 codedir = getcwd()+sep 62 63 codedirname = codedir + 'project.py' 69 #print 'name', __name__ 70 #print 'path', __file__ 71 #codedir = getcwd()+sep 72 73 #project_code_name = __name__ 74 75 #project_code_dir_name = __file__ 64 76 65 77 meshname = meshdir + basename … … 81 93 82 94 # for ferret2sww 83 #south = 84 #north = 85 #west = 86 #east = 95 south = degminsec2decimal_degrees(-20,30,0) 96 north = degminsec2decimal_degrees(-17,10,0) 97 west = degminsec2decimal_degrees(117,00,0) 98 east = degminsec2decimal_degrees(120,00,0) 87 99 88 100 # region to export (used from export_results.py) … … 96 108 97 109 # bounding polygon provided by Hamish 98 d0 = [818732.55, 8062768.27] 110 #d0 = [818732.55, 8062768.27] 111 d0 = [755000.0, 8025000.0] 99 112 d1 = [708940.32, 7750510.33] 100 113 d2 = [656561.15, 7732615.11] … … 102 115 d4 = [517682.34, 7899310.22] 103 116 104 polyAll = [d0, d 1, d2, d3, d4]117 polyAll = [d0, d4, d3, d2, d1] 105 118 106 119 #Interior region - Pt Hedland town 107 i0 = [690000, 7750510.33] # these are just currently close to d1, d2 and d3 108 i1 = [656561.15, 7750000] 109 i2 = [620000, 7733013.56] 120 i0 = [668000, 7757000] 121 i1 = [659000, 7755000] 122 i2 = [660000, 7749000] 123 i3 = [667000, 7746000] 124 i4 = [678000, 7751000] 110 125 111 poly_pt_hedland = [i0, i1, i2 ]126 poly_pt_hedland = [i0, i1, i2, i3, i4] 112 127 113 128 #Are there other significant features? 114 j0 = [ ]115 j1 = [ ]116 j2 = [ ]117 j3 = [ ]129 j0 = [670000, 7780000] 130 j1 = [620000, 7745000] 131 j2 = [665000, 7735000] 132 j3 = [700000, 7755000] 118 133 119 poly_ = [j0, j1, j2, j3]134 poly_region = [j0, j1, j2, j3] 120 135 -
production/pt_hedland_2006/run_pt_hedland.py
r2855 r2902 16 16 17 17 # Standard modules 18 import os 18 import os 19 20 from os import sep 21 from os.path import dirname, basename 22 19 23 import time 20 24 … … 47 51 48 52 # filenames 53 print 'run home', project.home 49 54 onshore_dem_name = project.onshore_dem_name 50 55 offshore_points1 = project.offshore_dem_name1 … … 54 59 55 60 61 62 63 #import sys; sys.exit() 64 56 65 # creates copy of code in output dir if dir doesn't exist 57 66 if access(project.outputtimedir,F_OK) == 0 : 58 67 mkdir (project.outputtimedir) 59 copy ( project.codedirname, project.outputtimedir + project.codename)60 copy ( project.codedir + 'run_pt_hedland.py', project.outputtimedir + 'run_pt_hedland.py')61 print'output dir', project.outputtimedir 68 copy (dirname(project.__file__) +sep+ project.__name__+'.py', project.outputtimedir + project.__name__+'.py') 69 copy (__file__, project.outputtimedir + basename(__file__)) 70 62 71 63 72 #normal screen output is stored in … … 67 76 #used to catch screen output to file 68 77 sys.stdout = Screen_Catcher(screen_output_name) 69 #sys.stderr = Screen_Catcher(screen_output_name) 70 #sys.stderr = Screen_Catcher(screen_error_name) 71 72 ''' 73 copied_files = False 74 75 # files to be used 76 files_used = [onshore_dem_name, offshore_points,] 77 78 if sys.platform != 'win32': 79 copied_files = True 80 for name in file_list: 81 copy(name, ) 82 ''' 83 #print' most file', project.MOST_dir + project.boundary_basename+'_ha.nc' 84 #if access(project.MOST_dir + project.boundary_basename+'_ha.nc',F_OK) == 1 : 85 # print' most file', project.MOST_dir + project.boundary_basename 86 87 78 sys.stderr = Screen_Catcher(screen_error_name) 79 80 81 ''' 88 82 # fine data (clipping the points file to smaller area) 89 83 # creates DEM from asc data … … 114 108 G.export_points_file(project.combined_dem_name + '.pts') 115 109 116 110 ''' 117 111 #------------------------------------------------------------------------------- 118 112 # Create the triangular mesh based on overall clipping polygon with a tagged … … 123 117 from pmesh.mesh_interface import create_mesh_from_regions 124 118 125 region_res = 25000119 region_res = 50000 126 120 coast_res = 2500 127 pt_hedland_res = 25000121 pt_hedland_res = 5000 128 122 # derive poly_coast from project.coast_name using alpha_shape 129 interior_regions = []#[[project.poly_pt_hedland, pt_hedland_res]]#, 130 #[project.poly_coast, coast_res], 131 #[project.poly_region, region_res]] 123 interior_regions = [[project.poly_pt_hedland, pt_hedland_res], 124 [project.poly_region, region_res]] 132 125 133 126 print 'number of interior regions', len(interior_regions) … … 136 129 _ = cache(create_mesh_from_regions, 137 130 project.polyAll, 138 {'boundary_tags': {'right': [0], 'bottomright': [1], 139 'bottomleft': [2], 'left': [3], 'top': [4]}, 140 'maximum_triangle_area': 250000, 131 # {'boundary_tags': {'right': [0], 'bottomright': [1], 132 # 'bottomleft': [2], 'left': [3], 'top': [4]}, 133 {'boundary_tags': {'top': [0], 'left': [1], 134 'bottomleft': [2], 'bottomright': [3], 'right': [4]}, 135 'maximum_triangle_area': 400000, 141 136 'filename': meshname, 142 137 'interior_regions': interior_regions}, … … 147 142 # Setup computational domain 148 143 #------------------------------------------------------------------------------- 149 144 ''' 150 145 domain = pmesh_to_domain_instance(meshname, Domain, 151 146 use_cache = False, 152 147 verbose = True) 148 ''' 149 150 domain = Domain(meshname, use_cache = False, verbose = True) 153 151 154 152 print 'Number of triangles = ', len(domain) … … 171 169 172 170 domain.set_quantity('elevation', 173 # filename = project.onshore_dem_name + '.pts',174 171 filename = project.combined_dem_name + '.pts', 175 # filename = project.offshore_dem_name1 + '.xya',176 # filename = project.offshore_dem_name2 + '.xya',177 172 use_cache = True, 178 173 verbose = True, … … 181 176 182 177 print 'hi1' 183 print 'have sent quantities OK - now exiting'184 import sys; sys.exit()178 #print 'have sent quantities OK - now exiting' 179 #import sys; sys.exit() 185 180 186 181 #------------------------------------------------------------------------------- … … 188 183 #------------------------------------------------------------------------------- 189 184 print 'start ferret2sww' 185 # skipped as results in file SU-AU_clipped is correct for all WA 186 190 187 from pyvolution.data_manager import ferret2sww 191 188 … … 199 196 (source_dir + project.boundary_basename, 200 197 source_dir + project.boundary_basename), 201 # (project.MOST_dir + project.boundary_basename,202 # source_dir + project.boundary_basename),203 198 {'verbose': True, 204 # note didn't work with the below205 # 'minlat': south - 1,206 # 'maxlat': north + 1,207 # 'minlon': west - 1,208 # 'maxlon': east + 1,209 199 'minlat': south, 210 200 'maxlat': north, … … 228 218 Bd = Dirichlet_boundary([tide,0,0]) 229 219 230 231 220 # 7 min square wave starting at 1 min, 6m high 232 221 Bw = Time_boundary(domain = domain, 233 222 f=lambda t: [(60<t<480)*6, 0, 0]) 234 223 235 domain.set_boundary( {'right': Br, 'bottomright': Br, 236 'bottomleft': Br, 'left': Br, 'top': Bf} ) 224 #domain.set_boundary( {'right': Br, 'bottomright': Br, 225 # 'bottomleft': Br, 'left': Br, 'top': Bf} ) 226 domain.set_boundary( {'top': Bf, 'left': Br, 'bottomleft': Br, 'bottomright': Br, 'right': Br} ) 237 227 238 228 #------------------------------------------------------------------------------- … … 242 232 t0 = time.time() 243 233 244 for t in domain.evolve(yieldstep = 240, finaltime = 720 1):245 domain.write_time() 246 domain.write_boundary_statistics(tags = 'top') 247 248 for t in domain.evolve(yieldstep = 120, finaltime = 12601249 ,skip_initial_step = True): 250 domain.write_time() 251 domain.write_boundary_statistics(tags = 'top') 252 253 for t in domain.evolve(yieldstep = 60, finaltime = 19801234 for t in domain.evolve(yieldstep = 240, finaltime = 7200): 235 domain.write_time() 236 domain.write_boundary_statistics(tags = 'top') 237 238 for t in domain.evolve(yieldstep = 240, finaltime = 12600 239 ,skip_initial_step = True): 240 domain.write_time() 241 domain.write_boundary_statistics(tags = 'top') 242 243 for t in domain.evolve(yieldstep = 240, finaltime = 19800 254 244 ,skip_initial_step = True): 255 245 domain.write_time() 256 246 domain.write_boundary_statistics(tags = 'top') 257 247 258 for t in domain.evolve(yieldstep = 120, finaltime = 25201259 ,skip_initial_step = True): 260 domain.write_time() 261 domain.write_boundary_statistics(tags = 'top') 262 263 for t in domain.evolve(yieldstep = 240, finaltime = 3600 1248 for t in domain.evolve(yieldstep = 240, finaltime = 25200 249 ,skip_initial_step = True): 250 domain.write_time() 251 domain.write_boundary_statistics(tags = 'top') 252 253 for t in domain.evolve(yieldstep = 240, finaltime = 36000 264 254 ,skip_initial_step = True): 265 255 domain.write_time()
Note: See TracChangeset
for help on using the changeset viewer.