Ejemplo n.º 1
0
 def pre_execute(self):
     oq = self.oqparam
     self.reaggreate = False
     if oq.hazard_calculation_id and not self.datastore.parent:
         self.datastore.parent = datastore.read(oq.hazard_calculation_id)
         assetcol = self.datastore['assetcol']
         self.aggkey = base.save_agg_values(self.datastore, assetcol,
                                            oq.loss_names, oq.aggregate_by)
         aggby = self.datastore.parent['oqparam'].aggregate_by
         self.reaggreate = oq.aggregate_by != aggby
         if self.reaggreate:
             self.num_tags = dict(
                 zip(aggby, assetcol.tagcol.agg_shape(aggby)))
     else:
         assetcol = self.datastore['assetcol']
         self.aggkey = assetcol.tagcol.get_aggkey(oq.aggregate_by)
     self.L = len(oq.loss_names)
Ejemplo n.º 2
0
 def pre_execute(self):
     oq = self.oqparam
     ds = self.datastore
     self.reaggreate = False
     if oq.hazard_calculation_id and not ds.parent:
         ds.parent = datastore.read(oq.hazard_calculation_id)
         assetcol = ds['assetcol']
         self.aggkey = base.save_agg_values(ds, assetcol, oq.loss_names,
                                            oq.aggregate_by)
         aggby = ds.parent['oqparam'].aggregate_by
         self.reaggreate = aggby and oq.aggregate_by != aggby
         if self.reaggreate:
             self.num_tags = dict(
                 zip(aggby, assetcol.tagcol.agg_shape(aggby)))
     else:
         assetcol = ds['assetcol']
         self.aggkey = assetcol.tagcol.get_aggkey(oq.aggregate_by)
     self.L = len(oq.loss_names)
     size = general.humansize(ds.getsize('agg_loss_table'))
     logging.info('Stored %s in the agg_loss_table', size)
Ejemplo n.º 3
0
 def pre_execute(self):
     oq = self.oqparam
     ds = self.datastore
     self.reaggreate = False
     if oq.hazard_calculation_id and not ds.parent:
         ds.parent = datastore.read(oq.hazard_calculation_id)
         self.aggkey = base.save_agg_values(ds, self.assetcol,
                                            oq.loss_types, oq.aggregate_by)
         aggby = ds.parent['oqparam'].aggregate_by
         self.reaggreate = aggby and oq.aggregate_by != aggby
         if self.reaggreate:
             self.num_tags = dict(
                 zip(aggby, self.assetcol.tagcol.agg_shape(aggby)))
     else:
         assetcol = ds['assetcol']
         self.aggkey = assetcol.tagcol.get_aggkey(oq.aggregate_by)
     self.L = len(oq.loss_types)
     if self.R > 1:
         self.num_events = numpy.bincount(ds['events']['rlz_id'],
                                          minlength=self.R)  # events by rlz
     else:
         self.num_events = numpy.array([len(ds['events'])])