Changeset 1903 for inundation/pyvolution/test_util.py
- Timestamp:
- Oct 12, 2005, 2:11:25 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/test_util.py
r1884 r1903 1019 1019 1020 1020 1021 def test_xya_ascii(self):1022 import time, os1023 FN = 'xyatest' + str(time.time()) + '.xya'1024 fid = open(FN, 'w')1025 fid.write(' %s %s %s\n' %('a1', 'a2', 'a3') )1026 fid.write('%f %f %f %f %f\n' %(0,1,10,20,30) )1027 fid.write('%f %f %f %f %f\n' %(1,0,30,20,10) )1028 fid.write('%f %f %f %f %f\n' %(1,1,40.2,40.3,40.4) )1029 fid.close()1030 1031 points, attributes = read_xya(FN, format = 'asc')1032 1033 assert allclose(points, [ [0,1], [1,0], [1,1] ])1034 assert allclose(attributes['a1'], [10,30,40.2])1035 assert allclose(attributes['a2'], [20,20,40.3])1036 assert allclose(attributes['a3'], [30,10,40.4])1037 1038 os.remove(FN)1039 1040 def test_xya_ascii_w_names(self):1041 import time, os1042 FN = 'xyatest' + str(time.time()) + '.xya'1043 fid = open(FN, 'w')1044 fid.write(' %s %s %s\n' %('a1', 'a2', 'a3') )1045 fid.write('%f %f %f %f %f\n' %(0,1,10,20,30) )1046 fid.write('%f %f %f %f %f\n' %(1,0,30,20,10) )1047 fid.write('%f %f %f %f %f\n' %(1,1,40.2,40.3,40.4) )1048 fid.close()1049 1050 points, attributes = read_xya(FN, format = 'asc')1051 1052 assert allclose(points, [ [0,1], [1,0], [1,1] ])1053 1054 assert allclose(attributes['a1'], [10,30,40.2])1055 assert allclose(attributes['a2'], [20,20,40.3])1056 assert allclose(attributes['a3'], [30,10,40.4])1057 1058 1059 os.remove(FN)1060 1061 1062 1063 1021 1064 1022 #Polygon stuff
Note: See TracChangeset
for help on using the changeset viewer.