Beispiel #1
0
 def get_loss_curve(point, vuln_function, asset):
     "Compute loss curve basing on hazard curve"
     job_profile = self.job_ctxt.oq_job_profile
     hazard_curve = hazard_curves[point.site]
     loss_ratio_curve = compute_loss_ratio_curve(
             vuln_function, hazard_curve,
             job_profile.lrem_steps_per_interval)
     return compute_loss_curve(loss_ratio_curve, asset.value)
Beispiel #2
0
 def get_loss_curve(point, vuln_function, asset):
     "Compute loss curve basing on hazard curve"
     job_profile = self.job_ctxt.oq_job_profile
     hazard_curve = hazard_curves[point.site]
     loss_ratio_curve = compute_loss_ratio_curve(
         vuln_function, hazard_curve,
         job_profile.lrem_steps_per_interval)
     return compute_loss_curve(loss_ratio_curve, asset.value)
Beispiel #3
0
 def get_loss_curve(site, vuln_function, asset):
     "Compute loss curve basing on hazard curve"
     job_profile = self.job_ctxt.oq_job_profile
     hazard_curve = self._get_db_curve(
         general.hazard_input_site(self.job_ctxt, site))
     loss_ratio_curve = compute_loss_ratio_curve(
             vuln_function, hazard_curve,
             job_profile.lrem_steps_per_interval)
     return compute_loss_curve(loss_ratio_curve, asset.value)
Beispiel #4
0
 def get_loss_curve(site, vuln_function, asset):
     "Compute loss curve basing on hazard curve"
     job_profile = self.job_ctxt.oq_job_profile
     hazard_curve = self._get_db_curve(
         general.hazard_input_site(self.job_ctxt, site))
     loss_ratio_curve = compute_loss_ratio_curve(
         vuln_function, hazard_curve,
         job_profile.lrem_steps_per_interval)
     return compute_loss_curve(loss_ratio_curve, asset.value)
Beispiel #5
0
    def compute_loss_curve(self, point, loss_ratio_curve, asset):
        """
        Computes the loss ratio and store it in kvs to provide
        data to the @output decorator which does the serialization.

        :param point: the point of the grid we want to compute
        :type point: :py:class:`openquake.shapes.GridPoint`
        :param loss_ratio_curve: the loss ratio curve
        :type loss_ratio_curve: :py:class `openquake.shapes.Curve`
        :param asset: the asset for which to compute the loss curve
        :type asset: :py:class:`dict` as provided by
               :py:class:`openquake.parser.exposure.ExposureModelFile`
        """

        loss_curve = compute_loss_curve(loss_ratio_curve, asset.value)
        loss_key = kvs.tokens.loss_curve_key(
            self.job_ctxt.job_id, point.row, point.column, asset.asset_ref)

        kvs.get_client().set(loss_key, loss_curve.to_json())

        return loss_curve
Beispiel #6
0
    def compute_loss_curve(self, point, loss_ratio_curve, asset):
        """
        Computes the loss ratio and store it in kvs to provide
        data to the @output decorator which does the serialization.

        :param point: the point of the grid we want to compute
        :type point: :py:class:`openquake.shapes.GridPoint`
        :param loss_ratio_curve: the loss ratio curve
        :type loss_ratio_curve: :py:class `openquake.shapes.Curve`
        :param asset: the asset for which to compute the loss curve
        :type asset: :py:class:`dict` as provided by
               :py:class:`openquake.parser.exposure.ExposureModelFile`
        """

        loss_curve = compute_loss_curve(loss_ratio_curve, asset.value)
        loss_key = kvs.tokens.loss_curve_key(self.job_ctxt.job_id, point.row,
                                             point.column, asset.asset_ref)

        kvs.get_client().set(loss_key, loss_curve.to_json())

        return loss_curve