- Timestamp:
- Oct 10, 2006, 4:54:34 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/geospatial_data/test_geospatial_data.py
r3733 r3735 476 476 477 477 478 def no_test_clip1_inside_outside(self):478 def test_clip1_inside_outside(self): 479 479 """test_clip1_inside_outside(self): 480 480 … … 509 509 FN = 'test_combine.pts' 510 510 G.export_points_file(FN) 511 512 513 # Read it back in 514 G3 = Geospatial_data(FN) 515 516 517 # Check result 518 assert allclose(G3.get_data_points(), new_points) 519 520 511 521 os.remove(FN) 512 522 … … 972 982 973 983 def test_writepts(self): 984 """test_writepts: Test that storage of x,y,attributes works 985 """ 974 986 att_dict = {} 975 987 pointlist = array([[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]]) … … 977 989 att_dict['brightness'] = array([10.0, 0.0, 10.4]) 978 990 geo_reference=Geo_reference(56,1.9,1.9) 979 991 992 # Test pts format 980 993 fileName = tempfile.mktemp(".pts") 981 982 994 G = Geospatial_data(pointlist, att_dict, geo_reference) 983 984 995 G.export_points_file(fileName, False) 985 986 results = Geospatial_data(file_name = fileName) 987 996 results = Geospatial_data(file_name=fileName) 988 997 os.remove(fileName) 989 998 … … 992 1001 answer = [10.0, 0.0, 10.4] 993 1002 assert allclose(results.get_attributes('brightness'), answer) 994 995 996 1003 self.failUnless(geo_reference == geo_reference, 997 1004 'test_writepts failed. Test geo_reference') 1005 1006 # Test xya format 1007 fileName = tempfile.mktemp(".xya") 1008 G = Geospatial_data(pointlist, att_dict, geo_reference) 1009 G.export_points_file(fileName, False) 1010 results = Geospatial_data(file_name=fileName) 1011 os.remove(fileName) 1012 assert allclose(results.get_data_points(False),[[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]]) 1013 assert allclose(results.get_attributes('elevation'), [10.0, 0.0, 10.4]) 1014 answer = [10.0, 0.0, 10.4] 1015 assert allclose(results.get_attributes('brightness'), answer) 1016 self.failUnless(geo_reference == geo_reference, 1017 'test_writepts failed. Test geo_reference') 1018 1019 def test_writepts_no_attributes(self): 1020 """test_writepts_no_attributes: Test that storage of x,y alone works 1021 """ 1022 att_dict = {} 1023 pointlist = array([[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]]) 1024 geo_reference=Geo_reference(56,1.9,1.9) 1025 1026 # Test pts format 1027 fileName = tempfile.mktemp(".pts") 1028 G = Geospatial_data(pointlist, None, geo_reference) 1029 G.export_points_file(fileName, False) 1030 results = Geospatial_data(file_name=fileName) 1031 os.remove(fileName) 1032 1033 assert allclose(results.get_data_points(False),[[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]]) 1034 self.failUnless(geo_reference == geo_reference, 1035 'test_writepts failed. Test geo_reference') 1036 1037 # Test xya format 1038 fileName = tempfile.mktemp(".xya") 1039 G = Geospatial_data(pointlist, None, geo_reference) 1040 G.export_points_file(fileName, False) 1041 results = Geospatial_data(file_name=fileName) 1042 os.remove(fileName) 1043 assert allclose(results.get_data_points(False),[[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]]) 1044 self.failUnless(geo_reference == geo_reference, 1045 'test_writepts failed. Test geo_reference') 1046 1047 998 1048 999 1049 ########################## BAD .PTS ##########################
Note: See TracChangeset
for help on using the changeset viewer.