Changeset 4181
- Timestamp:
- Jan 19, 2007, 12:15:26 PM (18 years ago)
- Location:
- anuga_core/source/anuga/geospatial_data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/geospatial_data/geospatial_data.py
r4180 r4181 733 733 fin_row = self.last_row 734 734 735 if self.verbose is True and \ 736 0==self.start_row%(( self.last_row+10)/10)==0: 737 print 'Doing %d of %d' %(self.start_row, self.last_row+10) 735 738 #call stuff 736 739 pointlist, att_dict, = \ -
anuga_core/source/anuga/geospatial_data/test_geospatial_data.py
r4180 r4181 1080 1080 os.remove(pts_file) 1081 1081 1082 def verbose_test_load_pts_blocking(self): 1083 """ test_load_csv(self): 1084 space delimited 1085 """ 1086 import os 1087 1088 fileName = tempfile.mktemp(".txt") 1089 file = open(fileName,"w") 1090 file.write(" x,y, elevation , speed \n\ 1091 1.0, 0.0, 10.0, 0.0\n\ 1092 0.0, 1.0, 0.0, 10.0\n\ 1093 1.0, 0.0, 10.0, 0.0\n\ 1094 0.0, 1.0, 0.0, 10.0\n\ 1095 1.0, 0.0, 10.0, 0.0\n\ 1096 0.0, 1.0, 0.0, 10.0\n\ 1097 1.0, 0.0, 10.0, 0.0\n\ 1098 0.0, 1.0, 0.0, 10.0\n\ 1099 1.0, 0.0, 10.0, 0.0\n\ 1100 0.0, 1.0, 0.0, 10.0\n\ 1101 1.0, 0.0, 10.0, 0.0\n\ 1102 0.0, 1.0, 0.0, 10.0\n\ 1103 1.0, 0.0, 10.0, 0.0\n\ 1104 0.0, 1.0, 0.0, 10.0\n\ 1105 1.0, 0.0, 10.0, 0.0\n\ 1106 0.0, 1.0, 0.0, 10.0\n\ 1107 1.0, 0.0, 10.0, 0.0\n\ 1108 0.0, 1.0, 0.0, 10.0\n\ 1109 1.0, 0.0, 10.0, 0.0\n\ 1110 0.0, 1.0, 0.0, 10.0\n\ 1111 1.0, 0.0, 10.0, 0.0\n\ 1112 0.0, 1.0, 0.0, 10.0\n\ 1113 1.0, 0.0, 10.0, 0.0\n\ 1114 0.0, 1.0, 0.0, 10.0\n\ 1115 1.0, 0.0, 10.0, 0.0\n\ 1116 0.0, 1.0, 0.0, 10.0\n\ 1117 1.0, 0.0, 10.0, 0.0\n\ 1118 0.0, 1.0, 0.0, 10.0\n\ 1119 1.0, 0.0, 10.0, 0.0\n\ 1120 0.0, 1.0, 0.0, 10.0\n\ 1121 1.0, 0.0, 10.0, 0.0\n\ 1122 0.0, 1.0, 0.0, 10.0\n\ 1123 1.0, 0.0, 10.0, 0.0\n\ 1124 0.0, 1.0, 0.0, 10.0\n\ 1125 1.0, 0.0, 10.0, 0.0\n\ 1126 0.0, 1.0, 0.0, 10.0\n\ 1127 1.0, 0.0, 10.0, 0.0\n\ 1128 0.0, 1.0, 0.0, 10.0\n\ 1129 1.0, 0.0, 10.0, 0.0\n\ 1130 0.0, 1.0, 0.0, 10.0\n\ 1131 1.0, 0.0, 10.0, 0.0\n\ 1132 0.0, 1.0, 0.0, 10.0\n\ 1133 1.0, 0.0, 10.0, 0.0\n\ 1134 0.0, 1.0, 0.0, 10.0\n\ 1135 1.0, 0.0, 10.0, 0.0\n\ 1136 0.0, 1.0, 0.0, 10.0\n\ 1137 1.0, 0.0 ,10.4, 40.0\n") 1138 file.close() 1139 1140 pts_file = tempfile.mktemp(".pts") 1141 1142 convert = Geospatial_data(fileName) 1143 convert.export_points_file(pts_file) 1144 results = Geospatial_data(pts_file, max_read_lines=2, verbose=True) 1145 1146 # Blocking 1147 geo_list = [] 1148 for i in results: 1149 geo_list.append(i) 1150 assert allclose(geo_list[0].get_data_points(), 1151 [[1.0, 0.0],[0.0, 1.0]]) 1152 assert allclose(geo_list[0].get_attributes(attribute_name='elevation'), 1153 [10.0, 0.0]) 1154 assert allclose(geo_list[1].get_data_points(), 1155 [[1.0, 0.0]]) 1156 assert allclose(geo_list[1].get_attributes(attribute_name='elevation'), 1157 [10.4]) 1158 1159 os.remove(fileName) 1160 os.remove(pts_file) 1161 1082 1162 1083 1163 def test_export_xya_file(self):
Note: See TracChangeset
for help on using the changeset viewer.