Changeset 3272
- Timestamp:
- Jul 4, 2006, 1:44:52 PM (19 years ago)
- Location:
- production/pt_hedland_2006
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
production/pt_hedland_2006/project.py
r3271 r3272 47 47 home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'2'+sep+'cit'+sep+'inundation'+sep+'data') 48 48 user = getenv('LOGNAME') 49 print 'USER:', user50 49 51 50 #Derive subdirectories and filenames -
production/pt_hedland_2006/run_pt_hedland.py
r3271 r3272 33 33 import project # Definition of file names and polygons 34 34 35 #------------------------------------------------------------------------------- 36 # Copy scripts to time stamped output directory and capture screen 37 # output to file 38 #------------------------------------------------------------------------------- 39 40 # creates copy of code in output dir if dir doesn't exist 41 if access(project.outputtimedir,F_OK) == 0 : 42 mkdir (project.outputtimedir) 43 copy (dirname(project.__file__) +sep+ project.__name__+'.py', project.outputtimedir + project.__name__+'.py') 44 copy (__file__, project.outputtimedir + basename(__file__)) 45 print 'project.outputtimedir',project.outputtimedir 46 47 # normal screen output is stored in 48 screen_output_name = project.outputtimedir + "screen_output.txt" 49 screen_error_name = project.outputtimedir + "screen_error.txt" 50 51 # used to catch screen output to file 52 sys.stdout = Screen_Catcher(screen_output_name) 53 sys.stderr = Screen_Catcher(screen_error_name) 54 print 'USER: ', project.user 35 55 36 56 #------------------------------------------------------------------------------- … … 48 68 meshname = project.meshname+'.msh' 49 69 source_dir = project.boundarydir 50 51 ## creates copy of code in output dir if dir doesn't exist52 if access(project.outputtimedir,F_OK) == 0 :53 mkdir (project.outputtimedir)54 copy (dirname(project.__file__) +sep+ project.__name__+'.py', project.outputtimedir + project.__name__+'.py')55 copy (__file__, project.outputtimedir + basename(__file__))56 57 print 'project.outputtimedir',project.outputtimedir58 59 ##normal screen output is stored in60 screen_output_name = project.outputtimedir + "screen_output.txt"61 screen_error_name = project.outputtimedir + "screen_error.txt"62 63 #used to catch screen output to file64 sys.stdout = Screen_Catcher(screen_output_name)65 sys.stderr = Screen_Catcher(screen_error_name)66 70 67 71 # fine data (clipping the points file to smaller area) … … 80 84 print 'create G1' 81 85 G1 = Geospatial_data(file_name = project.offshore_dem_name1 + '.xya') 82 83 86 print 'create G2' 84 87 G2 = Geospatial_data(file_name = project.offshore_dem_name2 + '.xya') 85 86 88 print 'create G3' 87 89 G3 = Geospatial_data(file_name = project.onshore_dem_name + '.pts') 88 89 90 print 'add G1+G2+G3' 90 91 G = G1 + G2 + G3 91 92 92 print 'export G' 93 93 G.export_points_file(project.combined_dem_name + '.pts') 94 95 94 96 95 #------------------------------------------------------------------------------- … … 105 104 coast_res = 25000 106 105 pt_hedland_res = 5000 107 # derive poly_coast from project.coast_name using alpha_shape108 #interior_regions = [[project.poly_pt_hedland, pt_hedland_res],109 106 interior_regions = [[project.poly_pt_hedland, pt_hedland_res], 110 107 [project.poly_region, region_res]] … … 112 109 print 'number of interior regions', len(interior_regions) 113 110 114 from utilities.polygon import inside_polygon, plot_polygons 115 116 bounding_polygon = project.polyAll 117 count = 0 118 for i in range(len(interior_regions)): 119 region = interior_regions[i] 120 interior_polygon = region[0] 121 if len(inside_polygon(interior_polygon, bounding_polygon, 122 closed = True, verbose = False)) <> len(interior_polygon): 123 print 'WARNING: interior polygon %d is outside bounding polygon' %(i) 124 count += 1 125 111 from utilities.polygon import plot_polygons 126 112 if sys.platform == 'win32': 127 113 #figname = project.outputtimedir + 'pt_hedland_polys' … … 131 117 verbose = True) 132 118 133 if count == 0:134 print 'interior regions OK'135 else:136 print 'check out your interior polygons'137 print 'check %s in production directory' %figname138 import sys; sys.exit()139 140 119 print 'start create mesh from regions' 141 120 from caching import cache 142 121 _ = cache(create_mesh_from_regions, 143 122 project.polyAll, 144 # project.poly_region, 145 # {'boundary_tags': {'right': [0], 'bottomright': [1], 146 # 'bottomleft': [2], 'left': [3], 'top': [4]}, 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]}, 123 {'boundary_tags': {'topright': [0], 'topleft': [1], 124 'left': [2], 'bottomleft': [3], 125 'bottomright': [4], 'right': [5]}, 151 126 'maximum_triangle_area': 500000, 152 127 'filename': meshname, 153 128 'interior_regions': interior_regions}, 154 129 verbose = True, evaluate=True) 155 156 130 157 131 #------------------------------------------------------------------------------- … … 206 180 cache(ferret2sww, 207 181 (source_dir + project.boundary_basename, 208 source_dir + project.boundary_basename ),182 source_dir + project.boundary_basename+'_'+project.basename), 209 183 {'verbose': True, 210 184 'minlat': south, … … 219 193 'inverted_bathymetry': True}, 220 194 evaluate = True, 221 verbose = True, )222 195 verbose = True, 196 dependencies = source_dir + project.boundary_basename + '.sww') 223 197 224 198 print 'Available boundary tags', domain.get_boundary_tags() … … 228 202 Br = Reflective_boundary(domain) 229 203 Bd = Dirichlet_boundary([tide,0,0]) 230 231 204 domain.set_boundary( {'topright': Bf,'topleft': Bf, 'left': Bd, 232 'bottomleft': Bd, 'bottomright': Bd, 'right': Bd}) 233 205 'bottomleft': Bd, 'bottomright': Bd, 'right': Bd}) 234 206 #------------------------------------------------------------------------------- 235 207 # Evolve system through time
Note: See TracChangeset
for help on using the changeset viewer.