Changeset 2252 for inundation/pyvolution/combine_pts.py
- Timestamp:
- Jan 19, 2006, 12:00:08 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/combine_pts.py
r2022 r2252 1 """Add two point files by the union of the fine and coarse points. 2 Course points that are in the extent of the fine points are removed. 3 4 The extent of the fine points file is assumed to be a rectangle, parallel 5 to the x and y axis. 1 """Functionality for aggregation of points files 6 2 7 3 Ole Nielsen, Stephen Roberts, Duncan Gray 8 4 Geoscience Australia, 2005. 9 5 """ 6 10 7 from utilities.polygon import outside_polygon, inside_polygon 11 8 from Numeric import take, concatenate … … 16 13 17 14 def combine_rectangular_points_files(fine_points_file, 18 coarse_points_file,19 output_points_file,15 coarse_points_file, 16 output_points_file, 20 17 verbose = False): 18 """Add two point files by the union of the fine and coarse points. 21 19 22 from load_mesh.loadASCII import import_points_file, extent, point_atts2array, export_points_file, add_point_dictionaries,take_points 20 Course points that are in the extent of the fine points are removed. 21 22 The extent of the fine points file is assumed to be a rectangle, parallel 23 to the x and y axis. 24 """ 25 26 from load_mesh.loadASCII import import_points_file, extent, point_atts2array, export_points_file, add_point_dictionaries, take_points 23 27 24 28 25 29 # load fine points file 26 if verbose: print "loading Point files"30 if verbose: print "loading Point files" 27 31 fine = import_points_file(fine_points_file) 28 32 … … 30 34 coarse = import_points_file(coarse_points_file) 31 35 32 if verbose: print "doing other stuff"36 if verbose: print "doing other stuff" 33 37 # convert to Numeric 34 38 fine = point_atts2array(fine) … … 44 48 if coarse.has_key('geo_reference'): 45 49 coarse['pointlist'] = \ 46 fine['geo_reference'].change_points_geo_ref(coarse['pointlist'],47 points_geo_ref=coarse['geo_reference'])50 fine['geo_reference'].change_points_geo_ref(coarse['pointlist'], 51 points_geo_ref=coarse['geo_reference']) 48 52 # find extent of course points 49 53 extent = extent(fine['pointlist']) … … 55 59 t0 = time.time() 56 60 outside_coarse_indices = outside_polygon(coarse['pointlist'], 57 extent, closed=True)61 extent, closed=True) 58 62 if verbose: 59 63 print "Points outside determined" … … 64 68 65 69 # add fine points and out_points 66 if verbose: print "Adding points"70 if verbose: print "Adding points" 67 71 combined = add_point_dictionaries(fine, coarse) 68 72 69 73 # save 70 if verbose: print "writing points"74 if verbose: print "writing points" 71 75 export_points_file(output_points_file, combined) 72 76 73 77 def add_points_files(fine_points_file, 74 coarse_points_file, 75 output_points_file, 76 verbose = False): 78 coarse_points_file, 79 output_points_file, 80 verbose = False): 81 """ 82 """ 77 83 78 84 from load_mesh.loadASCII import import_points_file, extent, point_atts2array, export_points_file, add_point_dictionaries,take_points … … 113 119 114 120 # add fine points and out_points 115 if verbose: print "Adding points"121 if verbose: print "Adding points" 116 122 combined = add_point_dictionaries(fine, coarse) 117 123 118 124 # save 119 if verbose: print "writing points"125 if verbose: print "writing points" 120 126 export_points_file(output_points_file, combined) 121 127 122 128 def reduce_points_to_mesh_extent(points_file, 123 mesh_file, 124 output_points_file, 125 verbose = False): 129 mesh_file, 130 output_points_file, 131 verbose = False): 132 """ 133 """ 126 134 127 135 from load_mesh.loadASCII import import_points_file, extent, point_atts2array, export_points_file, add_point_dictionaries,take_points, import_mesh_file … … 145 153 extent = \ 146 154 points['geo_reference'].change_points_geo_ref(extent, 147 points_geo_ref=mesh['geo_reference'])155 points_geo_ref=mesh['geo_reference']) 148 156 #print "extent",extent 149 157
Note: See TracChangeset
for help on using the changeset viewer.