Exemplo n.º 1
0
    def test_spillable_area2(self):

        # a test with a polygon spillable area

        poly = ((5, 2), (15, 2), (15, 10), (10, 10), (10, 5))
        gmap = RasterMap(refloat_halflife=6, bitmap_array=self.raster,
                         map_bounds=((-50, -30), (-50, 30), (50, 30),
                         (50, -30)), projection=NoProjection(),
                         spillable_area=[poly])  # hours

        # cases that are spillable

        assert gmap.allowable_spill_position((11.0, 3.0, 0.))
        assert gmap.allowable_spill_position((14.0, 9.0, 0.))

        # in polygon, but on land:

        assert not gmap.allowable_spill_position((11.0, 6.0, 0.))

        # outside polygon, on land:

        assert not gmap.allowable_spill_position((8.0, 6.0, 0.))

        # outside polygon, off land:

        assert not gmap.allowable_spill_position((3.0, 3.0, 0.))
Exemplo n.º 2
0
    def test_spillable_area2(self):

        # a test with a polygon spillable area

        poly = ((5, 2), (15, 2), (15, 10), (10, 10), (10, 5))
        gmap = RasterMap(refloat_halflife=6, bitmap_array=self.raster,
                         map_bounds=((-50, -30), (-50, 30), (50, 30),
                         (50, -30)), projection=NoProjection(),
                         spillable_area=[poly])  # hours

        # cases that are spillable

        assert gmap.allowable_spill_position((11.0, 3.0, 0.))
        assert gmap.allowable_spill_position((14.0, 9.0, 0.))

        # in polygon, but on land:

        assert not gmap.allowable_spill_position((11.0, 6.0, 0.))

        # outside polygon, on land:

        assert not gmap.allowable_spill_position((8.0, 6.0, 0.))

        # outside polygon, off land:

        assert not gmap.allowable_spill_position((3.0, 3.0, 0.))
Exemplo n.º 3
0
    def test_spillable_area(self):
        # anywhere not on land is spillable...
        # in this case
        gmap = RasterMap(refloat_halflife=6, bitmap_array=self.raster,
                         map_bounds=((-50, -30), (-50, 30),
                                     (50, 30), (50, -30)),
                         projection=NoProjection())

        # right in the middle of land
        print 'testing a land point:'
        assert not gmap.allowable_spill_position((10, 6, 0.))

        print 'testing a water point:'
        assert gmap.allowable_spill_position((19.0, 11.0, 0.))
Exemplo n.º 4
0
    def test_spillable_area(self):
        # anywhere not on land is spillable...
        # in this case
        gmap = RasterMap(refloat_halflife=6, bitmap_array=self.raster,
                         map_bounds=((-50, -30), (-50, 30),
                                     (50, 30), (50, -30)),
                         projection=NoProjection())

        # right in the middle of land
        print 'testing a land point:'
        assert not gmap.allowable_spill_position((10, 6, 0.))

        print 'testing a water point:'
        assert gmap.allowable_spill_position((19.0, 11.0, 0.))