anofa commited on
Commit
1eeb366
·
verified ·
1 Parent(s): 09e7ecf

Upload engine.py

Browse files
Files changed (1) hide show
  1. demo2/pages/engine.py +16 -2
demo2/pages/engine.py CHANGED
@@ -215,6 +215,13 @@ def run_engine(hazard_type, scenario, gdf_intensity, policies=[]):
215
  # Increase thresholds from “slight to moderate” as fewer people will be displaced.
216
  if 1 in policies and thresholds['metric7'] == DS_NO:
217
  thresholds['metric7'] = DS_SLIGHT
 
 
 
 
 
 
 
218
 
219
  # Policy-3: Cat-bond agreement for education and health facilities
220
  # Changes: Damage state thresholds for “loss of access to hospitals” and “loss of access to schools”
@@ -238,12 +245,19 @@ def run_engine(hazard_type, scenario, gdf_intensity, policies=[]):
238
  if 4 in policies:
239
  thresholds['metric6'] = 1
240
 
241
- if hazard_type == HAZARD_FLOOD or hazard_type == HAZARD_DEBRIS:
 
 
 
 
 
 
 
242
  # Policy-5: Technical assistance for debris removal in education facilities
243
  # loss of education is solved via this policy. For both flood and debris
244
  # loss of education metric is fixed.
245
  if 5 in policies:
246
- thresholds['metric2'] = 1
247
 
248
  #%% metric 1 number of unemployed workers in each building
249
  df_workers_per_building = df_workers[df_workers['ds'] > thresholds['metric1']].groupby('bldid',as_index=False).agg({'individ':'count'})
 
215
  # Increase thresholds from “slight to moderate” as fewer people will be displaced.
216
  if 1 in policies and thresholds['metric7'] == DS_NO:
217
  thresholds['metric7'] = DS_SLIGHT
218
+
219
+ if hazard_type == HAZARD_FLOOD:
220
+ # Policy-1: Loans for reconstruction for minor to moderate damages
221
+ # Changes: Damage state thresholds for “displacement”
222
+ # Increase thresholds from “slight to moderate” as fewer people will be displaced.
223
+ if 1 in policies:
224
+ thresholds['metric7'] = 1
225
 
226
  # Policy-3: Cat-bond agreement for education and health facilities
227
  # Changes: Damage state thresholds for “loss of access to hospitals” and “loss of access to schools”
 
245
  if 4 in policies:
246
  thresholds['metric6'] = 1
247
 
248
+ if hazard_type == HAZARD_EARTHQUAKE:
249
+ # Policy-5: Technical assistance for debris removal in education facilities
250
+ # loss of education is solved via this policy. For both flood and debris
251
+ # loss of education metric is fixed.
252
+ if 5 in policies:
253
+ thresholds['metric7'] = DS_SLIGHT
254
+
255
+ if hazard_type == HAZARD_FLOOD:
256
  # Policy-5: Technical assistance for debris removal in education facilities
257
  # loss of education is solved via this policy. For both flood and debris
258
  # loss of education metric is fixed.
259
  if 5 in policies:
260
+ thresholds['metric7'] = 1
261
 
262
  #%% metric 1 number of unemployed workers in each building
263
  df_workers_per_building = df_workers[df_workers['ds'] > thresholds['metric1']].groupby('bldid',as_index=False).agg({'individ':'count'})