Changeset 1091
- Timestamp:
- Mar 16, 2005, 6:56:12 PM (20 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/least_squares.py
r1004 r1091 24 24 # solution was having the user increase the size of the mesh to 25 25 # cover all the desired points. 26 #(Ole): Now we've got a pre-cropping facility. 26 27 27 28 … … 105 106 #FIXME (Ole): data_origin should be extracted here 106 107 try: 107 point_dict = load_points_file(point_file,delimiter = ',') 108 point_dict = load_points_file(point_file, 109 delimiter = ',', 110 verbose=verbose) 108 111 except SyntaxError,e: 109 point_dict = load_points_file(point_file,delimiter = ' ') 112 point_dict = load_points_file(point_file, 113 delimiter = ' ', 114 verbose=verbose) 115 110 116 point_coordinates = point_dict['pointlist'] 111 117 title_list,point_attributes = concatinate_attributelist(point_dict['attributelist']) … … 427 433 if verbose: print 'Getting indices inside mesh boundary' 428 434 indices = inside_polygon(point_coordinates, P, verbose = verbose) 429 435 430 436 if verbose: 437 print 'Done' 431 438 if len(indices) != point_coordinates.shape[0]: 432 439 print '%d points outside mesh have been cropped.'\ -
inundation/ga/storm_surge/pyvolution/test_util.py
r1063 r1091 915 915 polygon = [[0,0], [1,0], [0.5,-1], [2, -1], [2,1], [0,1]] 916 916 points = [ [0.5, 0.5], [1, -0.5], [1.5, 0], [0.5, 1.5], [0.5, -0.5]] 917 res = inside_polygon( points, polygon )917 res = inside_polygon( points, polygon, verbose=False ) 918 918 919 919 assert allclose( res, [0,1,2] ) -
inundation/ga/storm_surge/pyvolution/util.py
r1062 r1091 1045 1045 from Numeric import array, Float, reshape, zeros, Int 1046 1046 1047 1047 1048 if verbose: print 'Checking input to inside_polygon' 1048 1049 #Input checks 1049 1050 try: … … 1076 1077 from util_ext import inside_polygon 1077 1078 1079 if verbose: print 'Allocating array for indices' 1080 1078 1081 indices = zeros( points.shape[0], Int ) 1079 1082 1083 if verbose: print 'Calling C-version of inside poly' 1080 1084 count = inside_polygon(points, polygon, indices, 1081 1085 int(closed), int(verbose)) 1082 1083 #print 'O', point, count1084 1086 1085 1087 if one_point: 1086 1088 return count == 1 1087 1089 else: 1090 if verbose: print 'Got %d points' %count 1088 1091 return indices[:count] 1089 1092 -
inundation/ga/storm_surge/pyvolution/util_ext.c
r1032 r1091 77 77 //are far away from polygon 78 78 79 80 79 minpx = polygon[0]; maxpx = minpx; 81 80 minpy = polygon[1]; maxpy = minpy; … … 94 93 count = 0; 95 94 for (k=0; k<M; k++) { 96 //FIXME: Do this later97 //if (verbose){98 // if (k %((M+10)/10)==0: print 'Doing %d of %d' %(k, M)99 95 if (verbose){ 96 if (k %((M+10)/10)==0) printf("Doing %d of %d\n", k, M); 97 } 98 100 99 x = points[2*k]; 101 100 y = points[2*k + 1]; … … 230 229 N = polygon -> dimensions[0]; //Number of vertices in polygon 231 230 232 //printf("M=%d, N=%d\n", M, N); 231 if (verbose) printf("Got %d points and %d polygon vertices\n", M, N); 232 233 233 //Call underlying routine 234 234 count = _inside_polygon(M, N,
Note: See TracChangeset
for help on using the changeset viewer.