Esempio n. 1
0
    def sites_to_compute(self):
        """Return the sites used to trigger the computation on the
        hazard subsystem.

        If the SITES parameter is specified, the computation is triggered
        only on the sites specified in that parameter, otherwise
        the region is used.

        If the COMPUTE_HAZARD_AT_ASSETS_LOCATIONS parameter is specified,
        the hazard computation is triggered only on sites defined in the risk
        exposure file and located inside the region of interest.
        """

        if self.sites:
            return self.sites

        if jobconf.RISK_SECTION in self.sections and self.has(jobconf.COMPUTE_HAZARD_AT_ASSETS):

            print "COMPUTE_HAZARD_AT_ASSETS_LOCATIONS selected, " "computing hazard on exposure sites..."

            exposure.store_exposure_assets(self._job_id, self._base_path)
            self.sites = exposure.read_sites_from_exposure(self)
        elif self.has(jobconf.SITES):

            coords = self._extract_coords(jobconf.SITES)
            sites = []

            for coord in coords:
                sites.append(shapes.Site(coord[0], coord[1]))

            self.sites = sites
        else:
            self.sites = self._sites_for_region()

        return self.sites
Esempio n. 2
0
    def store_exposure_assets(self):
        """
        Load exposure assets from input file and store them
        into database, if necessary.
        """

        exposure_input.store_exposure_assets(
            self.job_ctxt.job_id, self.job_ctxt.base_path)
Esempio n. 3
0
    def store_exposure_assets(self):
        """
        Load exposure assets from input file and store them
        into database, if necessary.
        """

        exposure_input.store_exposure_assets(self.job_ctxt.job_id,
                                             self.job_ctxt.base_path)
Esempio n. 4
0
    def sites_to_compute(self):
        """Return the sites used to trigger the computation on the
        hazard subsystem.

        If the SITES parameter is specified, the computation is triggered
        only on the sites specified in that parameter, otherwise
        the region is used.

        If the COMPUTE_HAZARD_AT_ASSETS_LOCATIONS parameter is specified,
        the hazard computation is triggered only on sites defined in the risk
        exposure file and located inside the region of interest.
        """

        if self.sites:
            return self.sites

        if jobconf.RISK_SECTION in self.sections \
                and self.has(jobconf.COMPUTE_HAZARD_AT_ASSETS):

            print "COMPUTE_HAZARD_AT_ASSETS_LOCATIONS selected, " \
                "computing hazard on exposure sites..."

            exposure.store_exposure_assets(self._job_id, self._base_path)
            self.sites = exposure.read_sites_from_exposure(self)
        elif self.has(jobconf.SITES):

            coords = self._extract_coords(jobconf.SITES)
            sites = []

            for coord in coords:
                sites.append(shapes.Site(coord[0], coord[1]))

            self.sites = sites
        else:
            self.sites = self._sites_for_region()

        return self.sites