Esempio n. 1
0
    def test_with_risk_jobs_we_can_trigger_hazard_only_on_exposure_sites(self):
        # When we have hazard and risk jobs, we can ask to trigger
        # the hazard computation only on the sites specified
        # in the exposure file.
        self.params['COMPUTE_HAZARD_AT_ASSETS_LOCATIONS'] = True

        job_ctxt = engine.JobContext(
            self.params, self.job.id, sections=self.sections,
            oq_job_profile=self.jp)

        calc = EventBasedRiskCalculator(job_ctxt)
        calc.store_exposure_assets()

        expected_sites = set([
            shapes.Site(-118.077721, 33.852034),
            shapes.Site(-118.067592, 33.855398),
            shapes.Site(-118.186739, 33.779013)])

        actual_sites = set(job_ctxt.sites_to_compute())
        self.assertEqual(expected_sites, actual_sites)
Esempio n. 2
0
    def test_with_risk_jobs_we_can_trigger_hazard_only_on_exposure_sites(self):
        # When we have hazard and risk jobs, we can ask to trigger
        # the hazard computation only on the sites specified
        # in the exposure file.
        self.params['COMPUTE_HAZARD_AT_ASSETS_LOCATIONS'] = True

        job_ctxt = engine.JobContext(
            self.params, self.job.id, sections=self.sections,
            oq_job_profile=self.jp)

        calc = EventBasedRiskCalculator(job_ctxt)
        calc.store_exposure_assets()

        expected_sites = set([
            shapes.Site(-118.077721, 33.852034),
            shapes.Site(-118.067592, 33.855398),
            shapes.Site(-118.186739, 33.779013)])

        actual_sites = set(job_ctxt.sites_to_compute())
        self.assertEqual(expected_sites, actual_sites)