Session 3: Assignment#

Perform building damage analysis with given earthquake and tornado hazards. Then compare the damages.

Please follow the instruction at each cell.

1. Create a local dataset of building inventory from CSV#

Please use “shelby_police_fire_stations.csv” file

# Import modlues
from pyincore import FragilityService, HazardService, IncoreClient, Dataset, MappingSet
from pyincore.analyses.buildingdamage import BuildingDamage

import pandas as pd
import geopandas as gpd 
import json
# Connect to IN-CORE serivce by creating IncoreClient
client = IncoreClient()
# Initalize a FragilityService
fragility_services = FragilityService(client)
# TODO: Load CSV into GeoDataFrame
# TODO: Export GeoDataFarme to ESRI Shapefile 
# TODO: add GUID
# TODO: create a dataset boject with ESRI shapefile

2. Perform Building Damage analysis with an Earthquake#

Perform building damage analysis with the following input parameters and datasets

  • Hazard type: earthquake

  • Hazard ID: 5b902cb273c3371e1236b36b

  • Mapping ID: 5b47b350337d4a3629076f2c

# TODO: Define the variables that used for input parameters and datasets
hazard_type = ""
hazard_id = ""

mapping_id = ""

result_name = ""
# TODO: create fragility mapping object with id
# Create building damage
bldg_dmg_eq = BuildingDamage(client)

# TODO: Set up building damage analysis 
# TODO: run analysis
# TODO: Display the output of damage table by using DataFrame

2. Perform Building Damage analysis with an Tornado#

Perform building damage analysis with the following input parameters and datasets

  • Hazard type: tornado

  • Hazard ID: 60ad632f84525d4c31005a84

  • Mapping ID: 5d8942dfb9219c068ea795ea

# TODO: Define the variables that used for input parameters and datasets
hazard_type = ""
hazard_id = ""

mapping_id = ""

result_name = ""
# TODO: create fragility mapping object with id
# Create building damage
bldg_dmg_tornado = BuildingDamage(client)

# TODO: Set up building damage analysis 
# TODO: run analysis
# TODO: Display the output of damage table by using DataFrame

3. Compare damage outputs#

# TODO: Join two DataFrames with guid
# TODO: Display joined dataframe with most damaged (sorted by DS3 decending order)

Answers#

Please open session3-assignment-answer.ipynb.