Ignore:
Timestamp:
Oct 10, 2006, 4:54:34 PM (18 years ago)
Author:
ole
Message:

This fixes ticket:96 plus a few cosmetic things

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/geospatial_data/test_geospatial_data.py

    r3733 r3735  
    476476
    477477
    478     def no_test_clip1_inside_outside(self):
     478    def test_clip1_inside_outside(self):
    479479        """test_clip1_inside_outside(self):
    480480       
     
    509509        FN = 'test_combine.pts'
    510510        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       
    511521        os.remove(FN)
    512522
     
    972982       
    973983    def test_writepts(self):
     984        """test_writepts: Test that storage of x,y,attributes works
     985        """
    974986        att_dict = {}
    975987        pointlist = array([[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
     
    977989        att_dict['brightness'] = array([10.0, 0.0, 10.4])
    978990        geo_reference=Geo_reference(56,1.9,1.9)
    979        
     991
     992        # Test pts format
    980993        fileName = tempfile.mktemp(".pts")
    981        
    982994        G = Geospatial_data(pointlist, att_dict, geo_reference)
    983        
    984995        G.export_points_file(fileName, False)
    985        
    986         results = Geospatial_data(file_name = fileName)
    987 
     996        results = Geospatial_data(file_name=fileName)
    988997        os.remove(fileName)
    989998
     
    9921001        answer = [10.0, 0.0, 10.4]
    9931002        assert allclose(results.get_attributes('brightness'), answer)
    994 
    995        
    9961003        self.failUnless(geo_reference == geo_reference,
    9971004                         '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       
    9981048       
    9991049 ########################## BAD .PTS ##########################         
Note: See TracChangeset for help on using the changeset viewer.