Ignore:
Timestamp:
Jun 30, 2006, 3:19:05 PM (19 years ago)
Author:
duncan
Message:

using/expanding ensure_absolute

Location:
inundation/geospatial_data
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inundation/geospatial_data/geospatial_data.py

    r3177 r3262  
    697697                 relative to their respective origins.
    698698    """
     699    if isinstance(points,type('')):
     700        #It's a string
     701        #assume it is a point file
     702        points = Geospatial_data(file_name = points)
     703       
    699704    if isinstance(points,Geospatial_data):
    700705        points = points.get_data_points( \
     
    733738    """
    734739    if isinstance(points,Geospatial_data):
    735         #points = points.get_data_points( \
    736         #        absolute = True)
    737740        msg = "Use a Geospatial_data object or a mesh origin. Not both."
    738741        assert geo_reference == None, msg
     
    741744        points = ensure_numeric(points, Float)
    742745    if geo_reference is None:
    743         geo = None #Geo_reference()
     746        geo = None
    744747    else:
    745748        if isinstance(geo_reference, Geo_reference):
     
    749752                                geo_reference[1],
    750753                                geo_reference[2])
    751         points = Geospatial_data(data_points=points, geo_reference=geo)
    752         #points = geo.get_absolute(points)
     754        points = Geospatial_data(data_points=points, geo_reference=geo)       
    753755    return points
    754756             
  • inundation/geospatial_data/test_geospatial_data.py

    r3177 r3262  
    10311031        assert allclose(new_points, ab_points)
    10321032
     1033       
     1034        fileName = tempfile.mktemp(".xya")
     1035        file = open(fileName,"w")
     1036        file.write("  elevation   speed \n\
     10371.0 0.0 10.0 0.0\n\
     10380.0 1.0 0.0 10.0\n\
     10391.0 0.0 10.4 40.0\n\
     1040#geocrap\n\
     104156\n\
     104210\n\
     104320\n")
     1044        file.close()
     1045       
     1046        ab_points = ensure_absolute(fileName)
     1047        actual =  [[11, 20.0],[10.0, 21.0],[11.0, 20.0]]
     1048        assert allclose(ab_points, actual)
     1049        os.remove(fileName)
     1050
    10331051       
    10341052    def test_ensure_geospatial(self):
Note: See TracChangeset for help on using the changeset viewer.