Ignore:
Timestamp:
Feb 7, 2005, 6:03:02 PM (20 years ago)
Author:
ole
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/test_util.py

    r835 r841  
    343343        FN = 'xyatest' + str(time.time()) + '.xya'
    344344        fid = open(FN, 'w')
     345        fid.write('      %s %s %s\n' %('a1', 'a2', 'a3') )       
    345346        fid.write('%f %f %f %f %f\n' %(0,1,10,20,30) )
    346347        fid.write('%f %f %f %f %f\n' %(1,0,30,20,10) )
     
    348349        fid.close()
    349350       
    350         points, attributes, _ = read_xya(FN, format = 'asc')
    351        
     351        points, attributes = read_xya(FN, format = 'asc')
     352
    352353        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])       
    355357       
    356358        os.remove(FN)
     
    366368        fid.close()
    367369       
    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
    373372        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
    376378       
    377379        os.remove(FN)
Note: See TracChangeset for help on using the changeset viewer.