Ignore:
Timestamp:
Jan 9, 2007, 11:59:51 AM (18 years ago)
Author:
duncan
Message:

text points files: making the export of relative text points files obsolete.

Location:
anuga_core/source/anuga/geospatial_data
Files:
2 edited

Legend:

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

    r4135 r4150  
    66from os import access, F_OK, R_OK
    77from types import DictType
     8from warnings import warn
    89
    910from Numeric import concatenate, array, Float, shape, reshape, ravel, take, \
     
    578579        and yll and geo_reference remains uneffected
    579580        """
    580    
     581
     582        if absolute is False and file_name[-4:] == ".xya":
     583            msg = 'The text file values must be absolute.   '
     584            msg += 'Text file format is moving to comma seperated .txt files.'
     585            warn(msg, DeprecationWarning)
     586
    581587        if (file_name[-4:] == ".xya"):
    582588            if absolute is True:         
     
    600606                                self.get_all_attributes(),
    601607                                self.get_geo_reference())
     608               
     609        elif (file_name[-4:] == ".txt"):
     610            _write_xya_file(file_name,
     611                            self.get_data_points(absolute=True),
     612                            self.get_all_attributes())
     613                                   
    602614        else:
    603615            msg = 'Unknown file type %s ' %file_name
  • anuga_core/source/anuga/geospatial_data/test_geospatial_data.py

    r4146 r4150  
    970970        os.remove(fileName)
    971971       
    972     def test_export_xya_file(self):
     972    def depreciated_test_export_xya_file(self):
    973973#        dict = {}
    974974        att_dict = {}
     
    11261126       
    11271127    def test_writepts(self):
    1128         """test_writepts: Test that storage of x,y,attributes works
    1129         """
     1128        #test_writepts: Test that storage of x,y,attributes works
     1129       
    11301130        att_dict = {}
    11311131        pointlist = array([[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
     
    11481148                         'test_writepts failed. Test geo_reference')
    11491149
     1150    def test_write_xya_attributes(self):
     1151        #test_write xya: Test that storage of x,y,attributes works
     1152       
     1153        att_dict = {}
     1154        pointlist = array([[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
     1155        att_dict['elevation'] = array([10.0, 0.0, 10.4])
     1156        att_dict['brightness'] = array([10.0, 0.0, 10.4])
     1157        geo_reference=Geo_reference(56,0,0)
    11501158        # Test xya format
    11511159        fileName = tempfile.mktemp(".xya")
    11521160        G = Geospatial_data(pointlist, att_dict, geo_reference)
    1153         G.export_points_file(fileName, False)
     1161        G.export_points_file(fileName)
    11541162        results = Geospatial_data(file_name=fileName)
    11551163        os.remove(fileName)
     
    11621170
    11631171    def test_writepts_no_attributes(self):
    1164         """test_writepts_no_attributes: Test that storage of x,y alone works
    1165         """
     1172
     1173        #test_writepts_no_attributes: Test that storage of x,y alone works
     1174       
    11661175        att_dict = {}
    11671176        pointlist = array([[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
     
    11781187        self.failUnless(geo_reference == geo_reference,
    11791188                         'test_writepts failed. Test geo_reference')
    1180 
     1189       
     1190    def test_write_xya_no_attributes(self):
     1191        #test_write xya _no_attributes: Test that storage of x,y alone works
     1192       
     1193        att_dict = {}
     1194        pointlist = array([[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
     1195        geo_reference=Geo_reference(56,0,0)
    11811196        # Test xya format
    11821197        fileName = tempfile.mktemp(".xya")
    11831198        G = Geospatial_data(pointlist, None, geo_reference)
    1184         G.export_points_file(fileName, False)
     1199        G.export_points_file(fileName)
    11851200        results = Geospatial_data(file_name=fileName)
    11861201        os.remove(fileName)
Note: See TracChangeset for help on using the changeset viewer.