Exemplo n.º 1
0
 def load_crmodel(self):
     # to be called before read_exposure
     # NB: this is called even if there is no risk model
     """
     Read the risk models and set the attribute .crmodel.
     The crmodel can be empty for hazard calculations.
     Save the loss ratios (if any) in the datastore.
     """
     logging.info('Reading the risk model if present')
     self.crmodel = readinput.get_crmodel(self.oqparam)
     if not self.crmodel:
         parent = self.datastore.parent
         if 'risk_model' in parent:
             self.crmodel = riskmodels.CompositeRiskModel.read(parent)
         return
     if self.oqparam.ground_motion_fields and not self.oqparam.imtls:
         raise InvalidFile('No intensity_measure_types specified in %s' %
                           self.oqparam.inputs['job_ini'])
     self.save_params()  # re-save oqparam
Exemplo n.º 2
0
 def test_missing_vulnerability_function(self):
     oq = readinput.get_oqparam('job.ini', case_caracas)
     with self.assertRaises(ValidationError):
         readinput.get_crmodel(oq)