Skip to content

Commit 04f0e1d

Browse files
committed
Added displaced people to earthquake impact
1 parent 1bbfb01 commit 04f0e1d

File tree

1 file changed

+37
-18
lines changed

1 file changed

+37
-18
lines changed

impact_functions/earthquake/itb_earthquake_fatality_model.py

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ def run(self, layers,
9393
9494
"""
9595

96+
# Define percentages of people being displaced at each mmi level
97+
displacement_rate = {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0,
98+
7: 0.1, 8: 0.5, 9: 0.75, 10: 1.0}
99+
96100
# Extract input layers
97101
intensity = get_hazard_layer(layers)
98102
population = get_exposure_layer(layers)
@@ -108,7 +112,7 @@ def run(self, layers,
108112
# Calculate population affected by each MMI level
109113
# FIXME (Ole): this range is 2-9. Should 10 be included?
110114
mmi_range = range(2, 10)
111-
number_exposed = {}
115+
number_of_exposed = {}
112116
number_of_fatalities = {}
113117

114118
# Calculate fatality rates for observed Intensity values (H
@@ -131,7 +135,7 @@ def run(self, layers,
131135

132136
# Generate text with result for this study
133137
# This is what is used in the real time system exposure table
134-
number_exposed[mmi] = numpy.nansum(I.flat)
138+
number_of_exposed[mmi] = numpy.nansum(I.flat)
135139
number_of_fatalities[mmi] = numpy.nansum(F.flat)
136140

137141
# Set resulting layer to zero when less than a threshold. This is to
@@ -142,34 +146,49 @@ def run(self, layers,
142146
# Total statistics
143147
total = numpy.nansum(P.flat)
144148

145-
# This might be reported in real time system as well
149+
# Compute number of fatalities
146150
fatalities = numpy.nansum(number_of_fatalities.values())
147151

152+
# Compute number of people displaced due to building collapse
153+
displaced = 0
154+
for mmi in mmi_range:
155+
displaced += displacement_rate[mmi] * number_of_exposed[mmi]
156+
148157
# Generate impact report
149-
table_body = [question,
150-
TableRow([_('Groundshaking (MMI)'),
151-
_('# people impacted')],
152-
header=True)]
158+
table_body = [question,]
159+
#TableRow([_('Groundshaking (MMI)'),
160+
# _('# people impacted')],
161+
# header=True)]
153162

154163
# Table of people exposed to each shake level
155-
for mmi in mmi_range:
156-
s = str(int(number_exposed[mmi])).rjust(10)
157-
#print s, len(s)
158-
row = TableRow([mmi, s],
159-
col_align=['right', 'right'])
160-
161-
# FIXME (Ole): Weirdly enought, the row object
162-
# has align="right" in it, but it doesn't work
163-
#print row
164-
table_body.append(row)
164+
# NOTE: I have commented this out for the time being.
165+
#for mmi in mmi_range:
166+
# s = str(int(number_of_exposed[mmi])).rjust(10)
167+
# #print s, len(s)
168+
# row = TableRow([mmi, s],
169+
# col_align=['right', 'right'])
170+
#
171+
# # FIXME (Ole): Weirdly enough, the row object
172+
# # has align="right" in it, but it doesn't work
173+
# #print row
174+
# table_body.append(row)
165175

166176
# Add total fatality estimate
167177
s = str(int(fatalities)).rjust(10)
168178
table_body.append(TableRow([_('Number of fatalities'), s],
169179
header=True))
180+
181+
# Add total estimate of people displaced
182+
s = str(int(displaced)).rjust(10)
183+
table_body.append(TableRow([_('Number of people displaced'), s],
184+
header=True))
185+
186+
table_body.append(TableRow(_('Action Checklist:'), header=True))
187+
table_body.append(_('Are enough victim identification units available for %i people?') % fatalities)
188+
table_body.append(_('Are enough shelters available for %i people?') % displaced)
189+
170190
table_body.append(TableRow(_('Notes:'), header=True))
171191

172-
# FIXME (Ole): Need proper reference from Hadi
173192
table_body.append(_('Fatality model is from '
174193
'Institute of Teknologi Bandung 2012.'))
175194

0 commit comments

Comments
 (0)