Example #1
0
    def test_one_fire(self, reset_config, monkeypatch):
        monkeypatch_plumerise_class(monkeypatch)
        monkeypatch_tempfile_mkdtemp(monkeypatch)

        self.fm.load({"fires": [FIRE]})
        plumerise.run(self.fm)

        assert _PR_ARGS == ()
        assert _PR_KWARGS == defaults._DEFAULTS['plumerise']['feps']
        loc1 = FIRE['activity'][0]['active_areas'][0]['specified_points'][0]
        loc2 = FIRE['activity'][0]['active_areas'][1]['perimeter']
        assert _PR_COMPUTE_CALL_ARGS == [({
            "foo": 1
        }, {
            "smoldering": 123
        }, loc1), ({
            "bar": 2
        }, {
            "flaming": 434
        }, loc2)]
        assert _PR_COMPUTE_CALL_KWARGS == [{
            'working_dir':
            os.path.join(TEMPFILE_DIRS[-1], 'feps-plumerise-' + FIRE.id)
        }, {
            'working_dir':
            os.path.join(TEMPFILE_DIRS[-1], 'feps-plumerise-' + FIRE.id)
        }]
Example #2
0
    def test_fire_missing_localmet(self, reset_config, monkeypatch):
        monkeypatch_plumerise_class(monkeypatch)

        self.fm.load({"fires": [FIRE_MISSING_LOCALMET]})
        with raises(ValueError) as e_info:
            plumerise.run(self.fm)
        assert e_info.value.args[0] == plumerise.MISSING_LOCALMET_ERROR_MSG
Example #3
0
    def test_fire_no_activity(self, reset_config, monkeypatch):
        monkeypatch_plumerise_class(monkeypatch)

        self.fm.load({"fires": [FIRE_NO_ACTIVITY]})
        with raises(ValueError) as e_info:
            plumerise.run(self.fm)
        assert e_info.value.args[0] == plumerise.NO_ACTIVITY_ERROR_MSG
Example #4
0
    def test_fire_missing_start_time(self, reset_config, monkeypatch):
        monkeypatch_plumerise_class(monkeypatch)

        self.fm.load({"fires": [FIRE_MISSING_START_TIME]})
        with raises(ValueError) as e_info:
            plumerise.run(self.fm)
        assert e_info.value.args[0] == plumerise.MISSING_START_TIME_ERROR_MSG
Example #5
0
    def test_fire_missing_location_area(self, reset_config, monkeypatch):
        monkeypatch_plumerise_class(monkeypatch)

        self.fm.load({"fires": [FIRE_MISSING_LOCATION_AREA]})
        with raises(ValueError) as e_info:
            plumerise.run(self.fm)
        assert e_info.value.args[0] == activity.INVALID_LOCATION_MSGS['specified_points']
Example #6
0
    def test_fire_missing_location_consumption(self, reset_config, monkeypatch):
        monkeypatch_plumerise_class(monkeypatch)

        self.fm.load({"fires": [FIRE_MISSING_CONSUMPTION]})
        with raises(ValueError) as e_info:
            plumerise.run(self.fm)
        assert e_info.value.args[0] == plumerise.MISSING_CONSUMPTION_ERROR_MSG
Example #7
0
 def test_invalid_module(self, reset_config, monkeypatch):
     monkeypatch_plumerise_class(monkeypatch)
     Config().set('sdf', 'plumerise', 'model')
     fm = FiresManager()
     with raises(BlueSkyConfigurationError) as e_info:
         plumerise.run(fm)
     assert e_info.value.args[0] == plumerise.INVALID_PLUMERISE_MODEL_MSG.format('sdf')
Example #8
0
    def test_no_fires(self, reset_config, monkeypatch):
        monkeypatch_plumerise_class(monkeypatch)

        self.fm.load({"fires": []})
        plumerise.run(self.fm)

        assert _PR_ARGS == ()
        assert _PR_KWARGS == defaults._DEFAULTS['plumerise']['sev']
        assert _PR_COMPUTE_CALL_ARGS == []
Example #9
0
    def test_fire_missing_start_time(self, reset_config, monkeypatch):
        monkeypatch_plumerise_class(monkeypatch)

        self.fm.load({"fires": [FIRE_MISSING_START_TIME]})
        plumerise.run(self.fm)

        assert _PR_ARGS == ()
        assert _PR_KWARGS == defaults._DEFAULTS['plumerise']['sev']

        assert _PR_COMPUTE_CALL_ARGS == [({"baz": 444}, 123)]
        assert _PR_COMPUTE_CALL_KWARGS == [{'frp': None}]
Example #10
0
    def test_fire_missing_localmet(self, reset_config, monkeypatch):
        monkeypatch_plumerise_class(monkeypatch)

        self.fm.load({"fires": [FIRE_MISSING_LOCALMET]})
        plumerise.run(self.fm)

        assert _PR_ARGS == ()
        assert _PR_KWARGS == defaults._DEFAULTS['plumerise']['feps']
        loc1 = FIRE_MISSING_LOCALMET['activity'][0]['active_areas'][0]['specified_points'][0]
        assert _PR_COMPUTE_CALL_ARGS == [
            ({"foo": 1},{"smoldering": 123}, loc1)
        ]
        assert _PR_COMPUTE_CALL_KWARGS == [
            {'working_dir': None}
        ]
Example #11
0
    def test_one_fire(self, reset_config, monkeypatch):
        monkeypatch_plumerise_class(monkeypatch)

        self.fm.load({"fires": [FIRE]})
        plumerise.run(self.fm)

        assert _PR_ARGS == ()
        assert _PR_KWARGS == defaults._DEFAULTS['plumerise']['sev']
        loc1 = FIRE['activity'][0]['active_areas'][0]['specified_points'][0]
        loc2 = FIRE['activity'][0]['active_areas'][1]['perimeter']
        assert _PR_COMPUTE_CALL_ARGS == [({
            "baz": 444
        }, 123), ({
            "bazoo": 555
        }, 3232)]
        assert _PR_COMPUTE_CALL_KWARGS == [{'frp': None}, {'frp': None}]