Changeset 3129
- Timestamp:
- Jun 9, 2006, 1:26:51 PM (19 years ago)
- Location:
- inundation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/coordinate_transforms/geo_reference.py
r3071 r3129 7 7 8 8 import types, sys 9 from Numeric import array, Float, ArrayType, reshape 9 from Numeric import array, Float, ArrayType, reshape, allclose 10 10 from utilities.numerical_tools import ensure_numeric 11 11 from utilities.anuga_exceptions import ANUGAError, TitleError, ParsingError … … 178 178 179 179 return points 180 180 181 182 def is_absolute(self): 183 """Return True if xllcorner==yllcorner==0 indicating that points 184 in question are absolute. 185 """ 186 187 return allclose([self.xllcorner, self.yllcorner], 0) 188 189 181 190 182 191 def get_absolute(self, points): … … 186 195 """ 187 196 197 if self.is_absolute(): 198 return points 199 188 200 189 201 is_list = False -
inundation/coordinate_transforms/test_geo_reference.py
r2941 r3129 222 222 self.failUnless(point[0]+x==new_point[0], ' failed') 223 223 self.failUnless(point[1]+y==new_point[1], ' failed') 224 225 def test_is_absolute(self): 226 227 g = Geo_reference(34,0,0) 228 points = [[3.0,34.0], [64.0,6.0]] 229 230 assert g.is_absolute() 231 232 g = Geo_reference(34,7,-6) 233 assert not g.is_absolute() 234 224 235 225 236 def test___cmp__(self): -
inundation/pyvolution/general_mesh.py
r3128 r3129 211 211 V = self.vertex_coordinates 212 212 if absolute is True: 213 V0 = self.geo_reference.get_absolute(V[:,0:2]) 214 V1 = self.geo_reference.get_absolute(V[:,2:4]) 215 V2 = self.geo_reference.get_absolute(V[:,4:6]) 216 217 if not allclose(V0, V[:,0:2]): 218 # Only create new object if necessary (as it takes memory) 213 if not self.geo_reference.is_absolute(): 214 215 V0 = self.geo_reference.get_absolute(V[:,0:2]) 216 V1 = self.geo_reference.get_absolute(V[:,2:4]) 217 V2 = self.geo_reference.get_absolute(V[:,4:6]) 218 219 # This does double the memory need 219 220 V = concatenate( (V0, V1, V2), axis=1 ) 220 221 221 222 222 223 if obj is True: 223 #return concatenate( (V[:,0:2], V[:,2:4], V[:,4:6]), axis=0)224 224 225 225 N = V.shape[0]
Note: See TracChangeset
for help on using the changeset viewer.