Closed micheles closed 1 year ago
Related to occupants
losses, we may need to double-check how the different time periods are currently handled within the consequence calculation. This code makes it seem that the night occupants are used regardless of the time_period
specified (which is only relevant to the scenario_damage calculator).
def consequence(consequence, coeffs, asset, dmgdist, loss_type):
"""
:param consequence: kind of consequence
:param coeffs: coefficients per damage state
:param asset: asset record
:param dmgdist: an array of probabilies of shape (E, D - 1)
:param loss_type: loss type string
:returns: array of shape E
"""
if consequence not in KNOWN_CONSEQUENCES:
raise NotImplementedError(consequence)
elif consequence == 'losses':
return dmgdist @ coeffs * asset['value-' + loss_type]
elif consequence == 'collapsed':
return dmgdist @ coeffs * asset['value-number']
elif consequence == 'injured':
return dmgdist @ coeffs * asset['occupants_night']
elif consequence == 'fatalities':
return dmgdist @ coeffs * asset['occupants_night']
elif consequence == 'homeless':
return dmgdist @ coeffs * asset['occupants_night']
https://github.com/gem/oq-engine/blob/master/openquake/risklib/scientific.py#L1617
Additionally, occupants losses will rely on a different exposureField
for fatalities/injuries than for the population rendered homeless. We may need to consider differentiating these. For example, a loss type for fatalities and injuries could be casualties
(which uses the relevant time_period
or an average across the time periods specified in the exposure XML). The loss type for homeless could be occupants
(or a different name like residents
if we want to abandon the occupants
loss_type), which uses the total population within that building.
And make them regular loss types. On the other hand, making occupants completely different from loss types would work too, the issue is that now they are nearly loss types but not quite, thus making difficult to reason about them.
occupants_day|night|transit
may be thought of as secondary loss types. They enter in the multi_risk calculator.