Changeset 3398
- Timestamp:
- Jul 21, 2006, 2:26:18 PM (18 years ago)
- Location:
- inundation/pyvolution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/data_manager.py
r3336 r3398 729 729 class Exposure_csv: 730 730 def __init__(self,file_name, latitude_title=LAT_TITLE, 731 longitude_title=LONG_TITLE, is_x_y_locations= False,731 longitude_title=LONG_TITLE, is_x_y_locations=None, 732 732 x_title=X_TITLE, y_title=Y_TITLE, 733 733 refine_polygon=None): … … 777 777 except KeyError: 778 778 # maybe a warning.. 779 #Let's see if this works.. 780 if False != is_x_y_locations: 781 is_x_y_locations = True 779 782 pass 780 783 else: … … 782 785 longitudes = longs) 783 786 784 if is_x_y_locations :787 if is_x_y_locations is True: 785 788 if self._geospatial is not None: 786 789 pass #fixme throw an error -
inundation/pyvolution/test_data_manager.py
r3336 r3398 4913 4913 4914 4914 os.remove(file_name) 4915 4916 4917 def test_exposure_csv_loading_x_y2(self): 4918 4919 csv_file = tempfile.mktemp(".csv") 4920 fd = open(csv_file,'wb') 4921 writer = csv.writer(fd) 4922 writer.writerow(['x','y','STR_VALUE','C_VALUE','ROOF_TYPE','WALLS', 'SHORE_DIST']) 4923 writer.writerow([5.5,0.5,'199770','130000','Metal','Timber',20]) 4924 writer.writerow([4.5,1.0,'150000','76000','Metal','Double Brick',20]) 4925 writer.writerow([4.5,1.5,'150000','76000','Metal','Brick Veneer',20]) 4926 fd.close() 4927 4928 e1 = Exposure_csv(csv_file) 4929 gsd = e1.get_location() 4930 4931 points = gsd.get_data_points(absolute=True) 4932 assert allclose(points[0][0], 5.5) 4933 assert allclose(points[0][1], 0.5) 4934 assert allclose(points[1][0], 4.5) 4935 assert allclose(points[1][1], 1.0) 4936 assert allclose(points[2][0], 4.5) 4937 assert allclose(points[2][1], 1.5) 4938 self.failUnless(gsd.get_geo_reference().get_zone() == -1, 4939 'Bad zone error!') 4940 4941 os.remove(csv_file) 4915 4942 4916 4943 #------------------------------------------------------------- 4917 4944 if __name__ == "__main__": 4918 #suite = unittest.makeSuite(Test_Data_Manager,'test_exposure_csv_loadin y')4945 #suite = unittest.makeSuite(Test_Data_Manager,'test_exposure_csv_loading_x_y2') 4919 4946 suite = unittest.makeSuite(Test_Data_Manager,'test') 4920 4947 runner = unittest.TextTestRunner() 4921 4948 runner.run(suite) 4922 4949 4950
Note: See TracChangeset
for help on using the changeset viewer.