Ignore:
Timestamp:
Jun 2, 2006, 3:10:48 PM (19 years ago)
Author:
duncan
Message:

Fixing mesh_interface tests. geospatial_data.py now has ensure_geospatial.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/geospatial_data/geospatial_data.py

    r3051 r3056  
    704704    return points
    705705     
    706        
     706
     707def ensure_geospatial(points, geo_reference = None):
     708    """
     709    This function inputs several formats and
     710    outputs one format. - a geospatial_data instance.
     711
     712    Inputed formats are;
     713    points: List or numeric array of coordinate pairs [xi, eta] of
     714              points or geospatial object
     715
     716    mesh_origin: A geo_reference object or 3-tuples consisting of
     717                 UTM zone, easting and northing.
     718                 If specified vertex coordinates are assumed to be
     719                 relative to their respective origins.
     720    """
     721    if isinstance(points,Geospatial_data):
     722        #points = points.get_data_points( \
     723        #        absolute = True)
     724        msg = "Use a Geospatial_data object or a mesh origin. Not both."
     725        assert geo_reference == None, msg
     726           
     727    else:
     728        points = ensure_numeric(points, Float)
     729    if geo_reference is None:
     730        geo = None #Geo_reference()
     731    else:
     732        if isinstance(geo_reference, Geo_reference):
     733            geo = geo_reference
     734        else:
     735            geo = Geo_reference(geo_reference[0],
     736                                geo_reference[1],
     737                                geo_reference[2])
     738        points = Geospatial_data(data_points=points, geo_reference=geo)
     739        #points = geo.get_absolute(points)
     740    return points
     741             
Note: See TracChangeset for help on using the changeset viewer.