Changeset 2473
- Timestamp:
- Mar 3, 2006, 10:55:45 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/geospatial_data/test_geospatial_data.py
r2465 r2473 3 3 4 4 import unittest 5 import os 5 6 from Numeric import zeros, array, allclose, concatenate 6 7 from math import sqrt, pi … … 228 229 assert allclose(G.get_geo_reference().get_yllcorner(), 2.0) 229 230 assert allclose(G.get_data_points(), [[2.0, 4.1], [4.0, 7.3], [5.1, 9.3], [6.1, 6.3]]) 230 231 232 def xtest_create_from_file(self): 233 """Check that object can be created from a points file 234 """ 235 236 from load_mesh.loadASCII import export_points_file 237 238 239 points = [[1.0, 2.1], [3.0, 5.3], [5.0, 6.1], [6.0, 3.3]] 240 attributes = [2, 4, 5, 76] 241 242 # Use old pointsdict format 243 pointsdict = {'pointlist': points, 244 'attributelist': {'att1': attributes, 245 'att2': array(attributes) + 1}} 246 247 # Create points as an xya file 248 FN = 'test_points.xya' 249 export_points_file(FN, pointsdict) 250 251 252 #Create object from file 253 G = Geospatial_data(filename = FN) 254 255 assert allclose(G.get_data_points(), points) 256 assert allclose(G.get_attributes('att1'), attributes) 257 assert allclose(G.get_attributes('att2'), array(attributes) + 1) 258 259 260 261 os.remove(FN) 231 262 232 263
Note: See TracChangeset
for help on using the changeset viewer.