예제 #1
0
    def test_update_from_dict_MapFromBNA(self):
        'test update_from_dict for MapFromBNA'
        gmap = MapFromBNA(testbnamap, 6)

        dict_ = {}
        dict_['map_bounds'] = [(-10, 10), (10, 10), (10, -10), (-10, -10)]
        dict_['spillable_area'] = [[(-5, 5), (5, 5), (5, -5), (-5, -5)]]
        dict_['refloat_halflife'] = 2
        assert np.all(gmap.map_bounds != dict_['map_bounds'])

        gmap.update_from_dict(dict_)
        assert gmap.map_bounds is not dict_['map_bounds']
        assert np.all(gmap.map_bounds == dict_['map_bounds'])
예제 #2
0
    def test_update_spillable_area_polygons(self):
        map = MapFromBNA(bna_with_lake)

        map.update_from_dict({
            'spillable_area': [
                [(-82.86099, 24.54724), (-82.86099, 28.11176),
                 (-80.03136, 28.11176), (-80.03136, 24.54724)],
                [
                    (-82.86099, 24.54724),
                    (-82.86099, 28.11176),
                    (-80.03136, 28.11176),
                    (-80.03136, 24.54724),
                    (-80.03136, 28.11176),
                    (-80.03136, 24.54724),
                ],
            ]
        })

        assert len(map.spillable_area) == 2
        assert len(map.spillable_area[1]) == 6
예제 #3
0
    def test_update_spillable_area_none(self):
        map = MapFromBNA(bna_with_lake)

        map.update_from_dict({'spillable_area': None})