Changeset 8141
- Timestamp:
- Mar 10, 2011, 8:48:30 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/lib/order_boundary/order_boundary.py
r6213 r8141 30 30 31 31 32 ##33 # @brief Order a CSV file of boundary points.34 # @param Path to input file.35 # @param Path to output file.36 # @note Input file will have a header line that must be preserved.37 # @note File format is: (longitude, latitude, <other_fields>)38 # @note Fields after long+lat must be preserved.39 32 def order_boundary(infile, outfile): 33 """Order a CSV file of boundary points. 40 34 41 ## 42 # @brief Recursive routine to sort a list of point tuples: (x, y, ...). 43 # @param unordered Unordered list of points. 44 # @param ordered Return list of ordered points. 45 # @param is index into 'unordered' of point to put into 'ordered'. 46 # @note This code: 47 # . moves 'id' point from 'unordered' into 'ordered' 48 # . finds 'id' of next point to be moved 49 # . if more points, recurse 35 infile path to input filep 36 outfile path to output filep 37 38 Input file will have a header line that must be preserved. 39 File format is: (longitude, latitude, <other_fields>) 40 Fields after long+lat must be preserved. 41 """ 42 50 43 def sort_points(unordered, ordered, id): 44 """Sort a list of point tuples. 45 46 unordered unordered list of points. 47 ordered return list of ordered points. 48 id is index into 'unordered' of point to put into 'ordered' 49 50 This code: 51 . moves 'id' point from 'unordered' into 'ordered' 52 . finds 'id' of next point to be moved 53 . if more points, recurse 54 """ 55 51 56 # move 'id' point from unordered to ordered, get x0, y0 52 57 ordered.append(unordered[id])
Note: See TracChangeset
for help on using the changeset viewer.