Changeset 841 for inundation/ga/storm_surge/pyvolution/test_util.py
- Timestamp:
- Feb 7, 2005, 6:03:02 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/test_util.py
r835 r841 343 343 FN = 'xyatest' + str(time.time()) + '.xya' 344 344 fid = open(FN, 'w') 345 fid.write(' %s %s %s\n' %('a1', 'a2', 'a3') ) 345 346 fid.write('%f %f %f %f %f\n' %(0,1,10,20,30) ) 346 347 fid.write('%f %f %f %f %f\n' %(1,0,30,20,10) ) … … 348 349 fid.close() 349 350 350 points, attributes , _= read_xya(FN, format = 'asc')351 351 points, attributes = read_xya(FN, format = 'asc') 352 352 353 assert allclose(points, [ [0,1], [1,0], [1,1] ]) 353 assert allclose(attributes, [ [10,20,30], [30,20,10], 354 [40.2,40.3,40.4] ]) 354 assert allclose(attributes['a1'], [10,30,40.2]) 355 assert allclose(attributes['a2'], [20,20,40.3]) 356 assert allclose(attributes['a3'], [30,10,40.4]) 355 357 356 358 os.remove(FN) … … 366 368 fid.close() 367 369 368 points, attributes, attribute_names = read_xya(FN, format = 'asc') 369 370 assert attribute_names[0] == 'a1' 371 assert attribute_names[1] == 'a2' 372 assert attribute_names[2] == 'a3' 370 points, attributes = read_xya(FN, format = 'asc') 371 373 372 assert allclose(points, [ [0,1], [1,0], [1,1] ]) 374 assert allclose(attributes, [ [10,20,30], [30,20,10], 375 [40.2,40.3,40.4] ]) 373 374 assert allclose(attributes['a1'], [10,30,40.2]) 375 assert allclose(attributes['a2'], [20,20,40.3]) 376 assert allclose(attributes['a3'], [30,10,40.4]) 377 376 378 377 379 os.remove(FN)
Note: See TracChangeset
for help on using the changeset viewer.