Changeset 2531 for inundation/utilities/polygon.py
- Timestamp:
- Mar 13, 2006, 11:57:44 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/utilities/polygon.py
r2378 r2531 4 4 """ 5 5 6 7 try: 8 from scipy import Float, Int, zeros, ones, array, concatenate, reshape, dot 9 except: 10 print 'Could not find scipy - using Numeric' 11 from Numeric import Float, Int, zeros, ones, array, concatenate, reshape, dot 12 13 14 from math import sqrt 6 15 from utilities.numerical_tools import ensure_numeric 16 7 17 8 18 def point_on_line(x, y, x0, y0, x1, y1): … … 14 24 15 25 """ 16 17 from Numeric import array, dot, allclose18 from math import sqrt19 26 20 27 a = array([x - x0, y - y0]) … … 46 53 """ 47 54 48 from Numeric import array, Float, reshape49 50 55 if verbose: print 'Checking input to inside_polygon' 56 51 57 try: 52 58 points = ensure_numeric(points, Float) 59 except NameError, e: 60 raise NameError, e 53 61 except: 54 62 msg = 'Points could not be converted to Numeric array' … … 57 65 try: 58 66 polygon = ensure_numeric(polygon, Float) 67 except NameError, e: 68 raise NameError, e 59 69 except: 60 70 msg = 'Polygon %s could not be converted to Numeric array' %(str(polygon)) … … 88 98 """ 89 99 90 from Numeric import array, Float, reshape91 92 100 if verbose: print 'Checking input to outside_polygon' 93 101 try: 94 102 points = ensure_numeric(points, Float) 103 except NameError, e: 104 raise NameError, e 95 105 except: 96 106 msg = 'Points could not be converted to Numeric array' … … 99 109 try: 100 110 polygon = ensure_numeric(polygon, Float) 111 except NameError, e: 112 raise NameError, e 101 113 except: 102 114 msg = 'Polygon could not be converted to Numeric array' … … 166 178 """ 167 179 168 from Numeric import array, Float, reshape, Int, zeros169 170 171 180 #Input checks 172 181 … … 174 183 try: 175 184 points = ensure_numeric(points, Float) 185 except NameError, e: 186 raise NameError, e 176 187 except: 177 188 msg = 'Points could not be converted to Numeric array' … … 180 191 try: 181 192 polygon = ensure_numeric(polygon, Float) 193 except NameError, e: 194 raise NameError, e 182 195 except: 183 196 msg = 'Polygon could not be converted to Numeric array' … … 260 273 """ 261 274 262 from Numeric import array, Float, reshape, zeros, Int263 264 275 265 276 if verbose: print 'Checking input to separate_points_by_polygon' … … 274 285 try: 275 286 points = ensure_numeric(points, Float) 287 except NameError, e: 288 raise NameError, e 276 289 except: 277 290 msg = 'Points could not be converted to Numeric array' … … 281 294 try: 282 295 polygon = ensure_numeric(polygon, Float) 296 except NameError, e: 297 raise NameError, e 283 298 except: 284 299 msg = 'Polygon could not be converted to Numeric array' … … 385 400 386 401 def __call__(self, x, y): 387 from Numeric import ones, Float, concatenate, array, reshape, choose388 389 402 x = array(x).astype(Float) 390 403 y = array(y).astype(Float)
Note: See TracChangeset
for help on using the changeset viewer.