Changeset 6546
- Timestamp:
- Mar 18, 2009, 4:28:11 PM (14 years ago)
- Location:
- anuga_core/source/anuga
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/coordinate_transforms/geo_reference.py
r6438 r6546 72 72 if ASCIIFile is not None: 73 73 self.read_ASCII(ASCIIFile, read_title=read_title) 74 75 # Set flag for absolute points (used by get_absolute) 76 self.absolute = num.allclose([self.xllcorner, self.yllcorner], 0) 77 74 78 75 79 def get_xllcorner(self): … … 200 204 is_list = True 201 205 202 points = ensure_numeric( copy.copy(points), num.Float)206 points = ensure_numeric(points, num.Float) 203 207 204 208 if len(points.shape) == 1: … … 222 226 # If georeferences are different 223 227 228 points = copy.copy(points) # Don't destroy input 224 229 if not points_geo_ref is None: 225 230 # Convert points to absolute coordinates … … 242 247 in question are absolute. 243 248 """ 244 245 return num.allclose([self.xllcorner, self.yllcorner], 0) 246 249 250 # FIXME(Ole): It is unfortunate that decision about whether points 251 # are absolute or not lies with the georeference object. Ross pointed this out. 252 # Moreover, this little function is responsible for a large fraction of the time 253 # using in data fitting (something in like 40 - 50%. 254 # This was due to the repeated calls to allclose. 255 # With the flag method fitting is much faster (18 Mar 2009). 256 257 258 # FIXME(Ole): HACK to be able to reuse data already cached (18 Mar 2009). 259 # Remove at some point 260 if not hasattr(self, 'absolute'): 261 self.absolute = num.allclose([self.xllcorner, self.yllcorner], 0) 262 263 264 # Return absolute flag 265 return self.absolute 247 266 248 267 … … 253 272 """ 254 273 255 #if self.is_absolute():256 # return points257 274 is_list = False 258 275 if type(points) == types.ListType: 259 276 is_list = True 260 277 261 points = ensure_numeric( copy.copy(points), num.Float)278 points = ensure_numeric(points, num.Float) 262 279 if len(points.shape) == 1: 263 # One point has been passed280 # One point has been passed 264 281 msg = 'Single point must have two elements' 265 282 if not len(points) == 2: 266 283 raise ShapeError, msg 267 #points = reshape(points, (1,2))268 284 269 285 … … 276 292 # Add geo ref to points 277 293 if not self.is_absolute(): 294 points = copy.copy(points) # Don't destroy input 278 295 points[:,0] += self.xllcorner 279 296 points[:,1] += self.yllcorner … … 316 333 # Subtract geo ref from points 317 334 if not self.is_absolute(): 335 points = copy.copy(points) # Don't destroy input 318 336 points[:,0] -= self.xllcorner 319 337 points[:,1] -= self.yllcorner -
anuga_core/source/anuga/geospatial_data/test_geospatial_data.py
r6488 r6546 1988 1988 1989 1989 #suite = unittest.makeSuite(Test_Geospatial_data, 'test_write_csv_attributes_lat_long') 1990 #suite = unittest.makeSuite(Test_Geospatial_data, 'test_find_optimal_smoothing_parameter')1990 suite = unittest.makeSuite(Test_Geospatial_data, 'test_find_optimal_smoothing_parameter') 1991 1991 #suite = unittest.makeSuite(Test_Geospatial_data, 'test_split1') 1992 suite = unittest.makeSuite(Test_Geospatial_data, 'test')1992 #suite = unittest.makeSuite(Test_Geospatial_data, 'test') 1993 1993 runner = unittest.TextTestRunner() #verbosity=2) 1994 1994 runner.run(suite)
Note: See TracChangeset
for help on using the changeset viewer.