Example #1
0
    def pre_execute(self):
        """
        Read the curves and build the riskinputs.
        """
        super(ClassicalDamageCalculator, self).pre_execute()

        logging.info('Reading hazard curves from CSV')
        sites, hcurves_by_imt = readinput.get_sitecol_hcurves(self.oqparam)

        with self.monitor('assoc_assets_sites'):
            sitecol, assets_by_site = self.assoc_assets_sites(sites)
        num_assets = sum(len(assets) for assets in assets_by_site)
        num_sites = len(sitecol)
        logging.info('Associated %d assets to %d sites', num_assets, num_sites)

        logging.info('Preparing the risk input')
        self.riskinputs = self.build_riskinputs({
            (0, 'FromFile'): hcurves_by_imt
        })
        fake_rlz = logictree.Realization(value=('FromFile', ),
                                         weight=1,
                                         lt_path=('', ),
                                         ordinal=0,
                                         lt_uid=('*', ))
        self.rlzs_assoc = logictree.RlzsAssoc([fake_rlz])
Example #2
0
 def pre_execute(self):
     """
     Associate the assets to the sites and build the riskinputs.
     """
     super(ClassicalRiskCalculator, self).pre_execute()
     sites, hcurves_by_imt = readinput.get_sitecol_hcurves(self.oqparam)
     logging.info('Associating assets -> sites')
     with self.monitor('assoc_assets_sites'):
         sitecol, assets_by_site = self.assoc_assets_sites(sites)
     num_assets = sum(len(assets) for assets in assets_by_site)
     num_sites = len(sitecol)
     logging.info('Associated %d assets to %d sites', num_assets, num_sites)
     hcurves_by_imt = self.filter_hcurves(hcurves_by_imt, sitecol.indices)
     self.riskinputs = self.build_riskinputs(hcurves_by_imt)
Example #3
0
    def pre_execute(self):
        """
        Associate the assets to the sites and build the riskinputs.
        """
        super(ClassicalRiskCalculator, self).pre_execute()
        hazard_from_csv = 'hazard_curves' in self.oqparam.inputs
        if hazard_from_csv:
            self.sitecol, hcurves_by_imt = readinput.get_sitecol_hcurves(
                self.oqparam)
            self.sitecol, self.assets_by_site = \
                self.assoc_assets_sites(self.sitecol)

        logging.info('Preparing the risk input')
        self.riskinputs = self.build_riskinputs(
            self.datastore['curves_by_trt_gsim'])
    def pre_execute(self):
        """
        Associate the assets to the sites and build the riskinputs.
        """
        super(ClassicalRiskCalculator, self).pre_execute()
        hazard_from_csv = 'hazard_curves' in self.oqparam.inputs
        if hazard_from_csv:
            self.sitecol, hcurves_by_imt = readinput.get_sitecol_hcurves(
                self.oqparam)
            self.sitecol, self.assets_by_site = \
                self.assoc_assets_sites(self.sitecol)

        logging.info('Preparing the risk input')
        curves_by_trt_gsim = {}
        for dset in self.datastore['curves_by_sm'].values():
            for key, curves in dset.items():
                trt_id, gsim = key.split('-')
                curves_by_trt_gsim[int(trt_id), gsim] = curves.value
        self.riskinputs = self.build_riskinputs(curves_by_trt_gsim)
Example #5
0
    def pre_execute(self):
        """
        Associate the assets to the sites and build the riskinputs.
        """
        super(ClassicalRiskCalculator, self).pre_execute()
        hazard_from_csv = 'hazard_curves' in self.oqparam.inputs
        if hazard_from_csv:
            self.sitecol, hcurves_by_imt = readinput.get_sitecol_hcurves(
                self.oqparam)
            self.sitecol, self.assets_by_site = \
                self.assoc_assets_sites(self.sitecol)

        logging.info('Preparing the risk input')
        curves_by_trt_gsim = {}
        for dset in self.datastore['curves_by_sm'].values():
            for key, curves in dset.items():
                trt_id, gsim = key.split('-')
                curves_by_trt_gsim[int(trt_id), gsim] = curves.value
        self.riskinputs = self.build_riskinputs(curves_by_trt_gsim)
    def pre_execute(self):
        """
        Read the curves and build the riskinputs.
        """
        super(ClassicalDamageCalculator, self).pre_execute()

        logging.info('Reading hazard curves from CSV')
        sites, hcurves_by_imt = readinput.get_sitecol_hcurves(self.oqparam)

        with self.monitor('assoc_assets_sites'):
            sitecol, assets_by_site = self.assoc_assets_sites(sites)
        num_assets = sum(len(assets) for assets in assets_by_site)
        num_sites = len(sitecol)
        logging.info('Associated %d assets to %d sites', num_assets, num_sites)

        logging.info('Preparing the risk input')
        self.riskinputs = self.build_riskinputs(
            {(0, 'FromFile'): hcurves_by_imt})
        fake_rlz = logictree.Realization(
            value=('FromFile',), weight=1, lt_path=('',),
            ordinal=0, lt_uid=('*',))
        self.rlzs_assoc = logictree.RlzsAssoc([fake_rlz])