Changeset 2955
- Timestamp:
- May 24, 2006, 11:39:56 AM (19 years ago)
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/geospatial_data/geospatial_data.py
r2942 r2955 333 333 raise IOError, msg 334 334 except IOError, e: 335 fd.close() 335 fd.close() 336 336 # Catch this to add an error message 337 337 msg = 'Could not open file or incorrect file format %s:%s' %(file_name, e) -
inundation/geospatial_data/test_geospatial_data.py
r2942 r2955 514 514 0.0 1.0 0.0 10.0\n\ 515 515 1.0 0.0 10.4 40.0\n\ 516 #geo \n\516 #geocrap\n\ 517 517 56\n\ 518 1.1\n\519 1.0\n") 520 518 56.6\n\ 519 3\n" 520 ) 521 521 file.close() 522 522 try: -
inundation/utilities/polygon.py
r2912 r2955 401 401 return abs(poly_area/2) 402 402 403 def plot_polygons(polygons, 404 figname, 405 verbose = False): 403 def plot_polygons(polygons, figname, verbose=False): 406 404 407 405 """ Take list of polygons and plot. … … 422 420 423 421 assert type(polygons) == list,\ 424 ' polygon must be a list'425 422 'input must be a list of polygons' 423 426 424 ion() 427 425 hold(True) … … 431 429 miny = 1e10 432 430 maxy = 0.0 433 for i in range(len(polygons)): 434 x, y = poly_xy(polygons[i]) 431 432 for polygon in polygons: 433 x, y = poly_xy(polygon) 435 434 if min(x) < minx: minx = min(x) 436 435 if max(x) > maxx: maxx = max(x) … … 449 448 return vec 450 449 451 def poly_xy(poly ):450 def poly_xy(polygon, verbose=False): 452 451 """ this is used within plot_polygons so need to duplicate 453 452 the first point so can have closed polygon in plot 454 453 """ 455 454 456 assert type(poly[0]) == list,\457 'polygon must be a list of points' 458 459 x = []460 y = []461 n = len(poly)462 firstpt = poly[0]463 for i in range(n):464 thispt = poly[i]465 x.append(thispt[0]) 466 y.append(thispt[1])467 468 x .append(firstpt[0])469 y .append(firstpt[1])455 if verbose: print 'Checking input to poly_xy' 456 457 try: 458 polygon = ensure_numeric(polygon, Float) 459 except NameError, e: 460 raise NameError, e 461 except: 462 msg = 'Polygon %s could not be converted to Numeric array' %(str(polygon)) 463 raise msg 464 465 x = polygon[:,0] 466 y = polygon[:,1] 467 x = concatenate((x, [polygon[0,0]]), axis = 0) 468 y = concatenate((y, [polygon[0,1]]), axis = 0) 470 469 471 470 return x, y 471 472 # x = [] 473 # y = [] 474 # n = len(poly) 475 # firstpt = poly[0] 476 # for i in range(n): 477 # thispt = poly[i] 478 # x.append(thispt[0]) 479 # y.append(thispt[1]) 480 481 # x.append(firstpt[0]) 482 # y.append(firstpt[1]) 483 484 # return x, y 472 485 473 486 class Polygon_function: -
production/onslow_2006/export_results.py
r2902 r2955 7 7 from os import sep 8 8 9 time_dir = "20060426_004 517"9 time_dir = "20060426_004129" 10 10 directory = project.outputdir 11 11 name = directory + time_dir +sep + "source" -
production/pt_hedland_2006/project.py
r2954 r2955 130 130 d3 = [552686.0, 7871580.0] 131 131 #d4 = [604415.81, 7733013.56] 132 d4 = [63 0000.0, 7733013.56]132 d4 = [638000.0, 7733013.56] 133 133 #d5 = [656561.15, 7732615.11] 134 d5 = [6 57000.0, 7732615.11]134 d5 = [662000.0, 7732615.11] 135 135 #d6 = [708940.32, 7750510.33] 136 d6 = [6 82000.0, 7740510.33]136 d6 = [690000.0, 7740510.33] 137 137 138 138 polyAll = [d0, d1, d2, d3, d4, d5, d6] … … 149 149 #Are there other significant features? 150 150 j0 = [670000, 7760000] 151 j1 = [63 0000, 7745000]151 j1 = [633000, 7745000] 152 152 j2 = [665000, 7743000] 153 153 j3 = [690000, 7755000] … … 155 155 poly_region = [j0, j1, j2, j3] 156 156 157 coast_buffer_file = datadir+' buff_poly_pts_test.xya'157 coast_buffer_file = datadir+'pts2ascii_test.xya' 158 158 G = Geospatial_data(file_name=coast_buffer_file,delimiter=' ') 159 poly_coast = G.get_data_points()159 poly_coast = list(G.get_data_points()) 160 160 #print 'get_data_points()',G.get_data_points() 161 #print 'get_',poly_region 161 162 162 163 164 -
production/pt_hedland_2006/run_pt_hedland.py
r2954 r2955 74 74 75 75 #used to catch screen output to file 76 sys.stdout = Screen_Catcher(screen_output_name)77 sys.stderr = Screen_Catcher(screen_error_name)76 #sys.stdout = Screen_Catcher(screen_output_name) 77 #sys.stderr = Screen_Catcher(screen_error_name) 78 78 79 79 … … 122 122 interior_regions = [[project.poly_pt_hedland, pt_hedland_res], 123 123 [project.poly_coast, coast_res]] 124 # [project.poly_region, region_res]] 124 125 125 126 print 'number of interior regions', len(interior_regions) … … 137 138 count += 1 138 139 139 #figname = 'pt_hedland_polys' 140 #plot_polygons([project.polyAll,project.poly_pt_hedland,project.poly_region], 141 # figname, 142 # verbose = True) 140 figname = 'pt_hedland_polys' 141 print'pt_hedland_polys' 142 #plot_polygons([project.polyAll, project.poly_pt_hedland, project.poly_region], 143 plot_polygons([project.poly_coast], 144 figname, 145 verbose = True) 143 146 144 147 if count == 0: … … 148 151 print 'check %s in production directory' %figname 149 152 import sys; sys.exit() 150 153 151 154 print 'start create mesh from regions' 152 155 from caching import cache
Note: See TracChangeset
for help on using the changeset viewer.