Changeset 2473


Ignore:
Timestamp:
Mar 3, 2006, 10:55:45 AM (18 years ago)
Author:
ole
Message:

Created new test for creating a geospatial object from a file but deactivated the test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/geospatial_data/test_geospatial_data.py

    r2465 r2473  
    33
    44import unittest
     5import os
    56from Numeric import zeros, array, allclose, concatenate
    67from math import sqrt, pi
     
    228229        assert allclose(G.get_geo_reference().get_yllcorner(), 2.0)
    229230        assert allclose(G.get_data_points(), [[2.0, 4.1], [4.0, 7.3], [5.1, 9.3], [6.1, 6.3]])                             
    230        
     231
     232    def xtest_create_from_file(self):
     233        """Check that object can be created from a points file
     234        """
     235
     236        from load_mesh.loadASCII import export_points_file
     237       
     238
     239        points = [[1.0, 2.1], [3.0, 5.3], [5.0, 6.1], [6.0, 3.3]]
     240        attributes = [2, 4, 5, 76]
     241
     242        # Use old pointsdict format
     243        pointsdict = {'pointlist': points,
     244                      'attributelist': {'att1': attributes,
     245                                        'att2': array(attributes) + 1}}
     246       
     247        # Create points as an xya file
     248        FN = 'test_points.xya'
     249        export_points_file(FN, pointsdict)
     250
     251
     252        #Create object from file
     253        G = Geospatial_data(filename = FN)
     254
     255        assert allclose(G.get_data_points(), points)
     256        assert allclose(G.get_attributes('att1'), attributes)
     257        assert allclose(G.get_attributes('att2'), array(attributes) + 1)
     258       
     259
     260       
     261        os.remove(FN)
    231262       
    232263
Note: See TracChangeset for help on using the changeset viewer.