Changeset 5114


Ignore:
Timestamp:
Mar 4, 2008, 4:16:07 PM (16 years ago)
Author:
ole
Message:

Formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/utilities/polygon.py

    r5089 r5114  
    485485    Note: If two polygons overlap, the one last in the list takes precedence
    486486
    487     Coordinates specified in the call are assumed to be relative to the origin (georeference)
    488     e.g. used by domain. By specifying the optional argument georeference, all points are made relative.
     487    Coordinates specified in the call are assumed to be relative to the
     488    origin (georeference) e.g. used by domain.
     489    By specifying the optional argument georeference,
     490    all points are made relative.
    489491
    490492    FIXME: This should really work with geo_spatial point sets.
    491493    """
    492494
    493     def __init__(self, regions, default = 0.0, geo_reference = None):
     495    def __init__(self, regions, default=0.0, geo_reference=None):
    494496
    495497        try:
    496498            len(regions)
    497499        except:
    498             msg = 'Polygon_function takes a list of pairs (polygon, value). Got %s' %polygons
    499             raise msg
     500            msg = 'Polygon_function takes a list of pairs (polygon, value).'
     501            msg += 'Got %s' %polygons
     502            raise msg
    500503
    501504
     
    504507            a = len(T)
    505508        except:
    506             msg = 'Polygon_function takes a list of pairs (polygon, value). Got %s' %polygons
    507             raise msg
     509            msg = 'Polygon_function takes a list of pairs (polygon, value).'
     510            msg += 'Got %s' %polygons
     511            raise msg
    508512
    509513        assert a == 2, 'Must have two component each: %s' %T
     
    517521        self.default = default
    518522
    519         #Make points in polygons relative to geo_reference
     523        # Make points in polygons relative to geo_reference
    520524        self.regions = []
    521         for polygon, value in regions:
     525        for polygon, value in regions:
    522526            P = geo_reference.change_points_geo_ref(polygon)
    523527            self.regions.append( (P, value) )
     
    544548            indices = inside_polygon(points, polygon)
    545549
    546             #FIXME: This needs to be vectorised
     550            # FIXME: This needs to be vectorised
    547551            if callable(value):
    548552                for i in indices:
Note: See TracChangeset for help on using the changeset viewer.