-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,002 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright (c) 2019 University of Illinois and others. All rights reserved. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License v2.0 which accompanies this distribution, | ||
# and is available at https://www.mozilla.org/en-US/MPL/2.0/ | ||
|
||
|
||
from pyincore.analyses.buildingstructuraldamage.buildingutil import BuildingUtil | ||
from pyincore.analyses.buildingstructuraldamage.buildingstructuraldamage import BuildingStructuralDamage |
430 changes: 430 additions & 0 deletions
430
pyincore/analyses/buildingstructuraldamage/buildingstructuraldamage.py
Large diffs are not rendered by default.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
pyincore/analyses/buildingstructuraldamage/buildingutil.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2019 University of Illinois and others. All rights reserved. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License v2.0 which accompanies this distribution, | ||
# and is available at https://www.mozilla.org/en-US/MPL/2.0/ | ||
|
||
|
||
class BuildingUtil: | ||
"""Utility methods for the building damage analysis.""" | ||
DEFAULT_FRAGILITY_KEY = "Non-Retrofit Fragility ID Code" | ||
DEFAULT_TSUNAMI_HMAX_FRAGILITY_KEY = "Non-Retrofit Inundation Fragility ID Code" | ||
DEFAULT_TSUNAMI_MMAX_FRAGILITY_KEY = "Non-Retrofit MomentumFlux Fragility ID Code" | ||
DEFAULT_REPAIR_KEY = "Repair ID Code" | ||
BLDG_STORIES = "no_stories" | ||
PROPERTIES = "properties" | ||
BLDG_PERIOD = "period" | ||
GROUND_FAILURE_PROB = "groundFailureProb" |
115 changes: 115 additions & 0 deletions
115
tests/pyincore/analyses/buildingstructuraldamage/test_buildingstructuraldamage.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
from pyincore import IncoreClient, FragilityService, MappingSet, Earthquake, HazardService, Tsunami, Hurricane, \ | ||
Tornado | ||
from pyincore.analyses.buildingstructuraldamage.buildingstructuraldamage import BuildingStructuralDamage | ||
import pyincore.globals as pyglobals | ||
|
||
|
||
def run_with_base_class(): | ||
client = IncoreClient(pyglobals.INCORE_API_DEV_URL) | ||
hazardsvc = HazardService(client) | ||
|
||
########################################################## | ||
# Memphis Earthquake damage | ||
# New madrid earthquake using Atkinson Boore 1995 | ||
eq = Earthquake.from_hazard_service("5b902cb273c3371e1236b36b", hazardsvc) | ||
|
||
# Geology dataset | ||
liq_geology_dataset_id = "5a284f53c7d30d13bc08249c" | ||
|
||
# Building dataset | ||
# 5a284f0bc7d30d13bc081a28 5kb | ||
# 5bcf2fcbf242fe047ce79dad 300kb | ||
# 5a284f37c7d30d13bc08219c 20mb | ||
bldg_dataset_id = "5a284f0bc7d30d13bc081a28" | ||
|
||
bldg_dmg = BuildingStructuralDamage(client) | ||
bldg_dmg.load_remote_input_dataset("buildings", bldg_dataset_id) | ||
|
||
# Earthquake mapping | ||
mapping_id = "5b47b350337d4a3629076f2c" | ||
fragility_service = FragilityService(client) | ||
mapping_set = MappingSet(fragility_service.get_mapping(mapping_id)) | ||
bldg_dmg.set_input_dataset('dfr3_mapping_set', mapping_set) | ||
|
||
bldg_dmg.set_input_hazard("hazard", eq) | ||
|
||
result_name = "memphis_eq_bldg_dmg_result" | ||
bldg_dmg.set_parameter("result_name", result_name) | ||
bldg_dmg.set_parameter("num_cpu", 4) | ||
bldg_dmg.set_parameter("use_liquefaction", True) | ||
bldg_dmg.set_parameter("liquefaction_geology_dataset_id", liq_geology_dataset_id) | ||
|
||
# Run Analysis | ||
bldg_dmg.run_analysis() | ||
|
||
########################################################## | ||
# TSUNAMI | ||
tsunami = Tsunami.from_hazard_service("5bc9e25ef7b08533c7e610dc", hazardsvc) | ||
|
||
# Seaside building dataset | ||
bldg_dataset_id = "5bcf2fcbf242fe047ce79dad" | ||
|
||
# Run seaside tsunami building damage | ||
bldg_dmg = BuildingStructuralDamage(client) | ||
bldg_dmg.load_remote_input_dataset("buildings", bldg_dataset_id) | ||
|
||
# Tsunami mapping | ||
mapping_id = "5b48fb1f337d4a478e7bd54d" | ||
fragility_service = FragilityService(client) | ||
mapping_set = MappingSet(fragility_service.get_mapping(mapping_id)) | ||
bldg_dmg.set_input_dataset('dfr3_mapping_set', mapping_set) | ||
bldg_dmg.set_input_hazard("hazard", tsunami) | ||
result_name = "seaside_tsunami_dmg_result" | ||
bldg_dmg.set_parameter("result_name", result_name) | ||
bldg_dmg.set_parameter("num_cpu", 4) | ||
bldg_dmg.run_analysis() | ||
|
||
########################################################## | ||
# Hurricane | ||
hurricane = Hurricane.from_hazard_service("5f11e50cc6491311a814584c", hazardsvc) | ||
|
||
# Galveston building dataset 602eba8bb1db9c28aef01358 | ||
bldg_dataset_id = "602eba8bb1db9c28aef01358" # 19k buildings with age_group | ||
# bldg_dataset_id = "602d61d0b1db9c28aeedea03" # 40 buildings without age_group | ||
|
||
bldg_dmg = BuildingStructuralDamage(client) | ||
bldg_dmg.load_remote_input_dataset("buildings", bldg_dataset_id) | ||
|
||
# Hurricane building mapping (with equation) | ||
mapping_id = "602c381a1d85547cdc9f0675" | ||
fragility_service = FragilityService(client) | ||
mapping_set = MappingSet(fragility_service.get_mapping(mapping_id)) | ||
bldg_dmg.set_input_dataset('dfr3_mapping_set', mapping_set) | ||
bldg_dmg.set_parameter("fragility_key", "Hurricane SurgeLevel and WaveHeight Fragility ID Code") | ||
|
||
bldg_dmg.set_input_hazard("hazard", hurricane) | ||
|
||
result_name = "galveston_hurr_dmg_result" | ||
bldg_dmg.set_parameter("result_name", result_name) | ||
bldg_dmg.set_parameter("num_cpu", 4) | ||
bldg_dmg.run_analysis() | ||
|
||
########################################################## | ||
# joplin tornado without strategy | ||
bldg_dataset_id = "5df7d0de425e0b00092d0082" # joplin building v6 | ||
|
||
bldg_dmg = BuildingStructuralDamage(client) | ||
bldg_dmg.load_remote_input_dataset("buildings", bldg_dataset_id) | ||
|
||
mapping_id = "5e8e3a21eaa8b80001f04f1c" # 19 archetype mapping | ||
fragility_service = FragilityService(client) | ||
mapping_set = MappingSet(fragility_service.get_mapping(mapping_id)) | ||
bldg_dmg.set_input_dataset('dfr3_mapping_set', mapping_set) | ||
|
||
tornado = Tornado.from_hazard_service("5dfa32bbc0601200080893fb", hazardsvc) | ||
bldg_dmg.set_input_hazard("hazard", tornado) | ||
|
||
result_name = "joplin_tornado_dmg_result" | ||
bldg_dmg.set_parameter("result_name", result_name) | ||
bldg_dmg.set_parameter("num_cpu", 4) | ||
bldg_dmg.set_parameter("seed", 1000) | ||
bldg_dmg.run_analysis() | ||
|
||
|
||
if __name__ == '__main__': | ||
run_with_base_class() |
125 changes: 125 additions & 0 deletions
125
tests/pyincore/analyses/buildingstructuraldamage/test_buildingstructuraldamage_legacy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import os | ||
|
||
from pyincore import IncoreClient, FragilityService, MappingSet | ||
from pyincore.analyses.buildingstructuraldamage.buildingstructuraldamage import BuildingStructuralDamage | ||
import pyincore.globals as pyglobals | ||
|
||
|
||
def run_with_base_class(): | ||
result_folder = "legacy" | ||
if not os.path.exists(result_folder): | ||
os.mkdir(result_folder) | ||
|
||
client = IncoreClient(pyglobals.INCORE_API_DEV_URL) | ||
|
||
# Memphis Earthquake damage | ||
# New madrid earthquake using Atkinson Boore 1995 | ||
hazard_type = "earthquake" | ||
hazard_id = "5b902cb273c3371e1236b36b" | ||
|
||
# Geology dataset | ||
liq_geology_dataset_id = "5a284f53c7d30d13bc08249c" | ||
|
||
# Building dataset | ||
# 5a284f0bc7d30d13bc081a28 5kb | ||
# 5bcf2fcbf242fe047ce79dad 300kb | ||
# 5a284f37c7d30d13bc08219c 20mb | ||
bldg_dataset_id = "5a284f0bc7d30d13bc081a28" | ||
|
||
bldg_dmg = BuildingStructuralDamage(client) | ||
bldg_dmg.load_remote_input_dataset("buildings", bldg_dataset_id) | ||
|
||
# Earthquake mapping | ||
mapping_id = "5b47b350337d4a3629076f2c" | ||
fragility_service = FragilityService(client) | ||
mapping_set = MappingSet(fragility_service.get_mapping(mapping_id)) | ||
bldg_dmg.set_input_dataset('dfr3_mapping_set', mapping_set) | ||
|
||
result_name = os.path.join(result_folder, "memphis_eq_bldg_dmg_result") | ||
bldg_dmg.set_parameter("result_name", result_name) | ||
bldg_dmg.set_parameter("hazard_type", hazard_type) | ||
bldg_dmg.set_parameter("hazard_id", hazard_id) | ||
bldg_dmg.set_parameter("num_cpu", 4) | ||
bldg_dmg.set_parameter("use_liquefaction", True) | ||
bldg_dmg.set_parameter("liquefaction_geology_dataset_id", liq_geology_dataset_id) | ||
|
||
# Run Analysis | ||
bldg_dmg.run_analysis() | ||
|
||
# TSUNAMI | ||
|
||
hazard_type = "tsunami" | ||
hazard_id = "5bc9e25ef7b08533c7e610dc" | ||
|
||
# Seaside building dataset | ||
bldg_dataset_id = "5bcf2fcbf242fe047ce79dad" | ||
|
||
# Run seaside tsunami building damage | ||
bldg_dmg = BuildingStructuralDamage(client) | ||
bldg_dmg.load_remote_input_dataset("buildings", bldg_dataset_id) | ||
|
||
# Tsunami mapping | ||
mapping_id = "5b48fb1f337d4a478e7bd54d" | ||
fragility_service = FragilityService(client) | ||
mapping_set = MappingSet(fragility_service.get_mapping(mapping_id)) | ||
bldg_dmg.set_input_dataset('dfr3_mapping_set', mapping_set) | ||
|
||
result_name = os.path.join(result_folder, "seaside_tsunami_dmg_result") | ||
bldg_dmg.set_parameter("result_name", result_name) | ||
bldg_dmg.set_parameter("hazard_type", hazard_type) | ||
bldg_dmg.set_parameter("hazard_id", hazard_id) | ||
bldg_dmg.set_parameter("num_cpu", 4) | ||
bldg_dmg.run_analysis() | ||
|
||
# Hurricane | ||
|
||
hazard_type = "hurricane" | ||
hazard_id = "5f11e50cc6491311a814584c" | ||
|
||
# Galveston building dataset 602eba8bb1db9c28aef01358 | ||
bldg_dataset_id = "602eba8bb1db9c28aef01358" # 19k buildings with age_group | ||
# bldg_dataset_id = "602d61d0b1db9c28aeedea03" # 40 buildings without age_group | ||
|
||
bldg_dmg = BuildingStructuralDamage(client) | ||
bldg_dmg.load_remote_input_dataset("buildings", bldg_dataset_id) | ||
|
||
# Hurricane building mapping (with equation) | ||
mapping_id = "602c381a1d85547cdc9f0675" | ||
fragility_service = FragilityService(client) | ||
mapping_set = MappingSet(fragility_service.get_mapping(mapping_id)) | ||
bldg_dmg.set_input_dataset('dfr3_mapping_set', mapping_set) | ||
bldg_dmg.set_parameter("fragility_key", "Hurricane SurgeLevel and WaveHeight Fragility ID Code") | ||
|
||
result_name = os.path.join(result_folder, "galveston_hurr_dmg_result") | ||
bldg_dmg.set_parameter("result_name", result_name) | ||
bldg_dmg.set_parameter("hazard_type", hazard_type) | ||
bldg_dmg.set_parameter("hazard_id", hazard_id) | ||
bldg_dmg.set_parameter("num_cpu", 4) | ||
bldg_dmg.run_analysis() | ||
|
||
# joplin tornado with retrofit strategy | ||
bldg_dataset_id = "5df7d0de425e0b00092d0082" # joplin building v6 | ||
retrofit_strategy_id = "660ab8f8ce705a7e54748557" # plan 1 | ||
|
||
bldg_dmg = BuildingStructuralDamage(client) | ||
bldg_dmg.load_remote_input_dataset("buildings", bldg_dataset_id) | ||
bldg_dmg.load_remote_input_dataset("retrofit_strategy", retrofit_strategy_id) | ||
|
||
mapping_id = "5e8e3a21eaa8b80001f04f1c" # 19 archetype with retrofit | ||
fragility_service = FragilityService(client) | ||
mapping_set = MappingSet(fragility_service.get_mapping(mapping_id)) | ||
bldg_dmg.set_input_dataset('dfr3_mapping_set', mapping_set) | ||
|
||
hazard_type = "tornado" | ||
hazard_id = "5dfa32bbc0601200080893fb" | ||
result_name = os.path.join(result_folder, "joplin_tornado_dmg_result_w_retrofit") | ||
bldg_dmg.set_parameter("result_name", result_name) | ||
bldg_dmg.set_parameter("hazard_type", hazard_type) | ||
bldg_dmg.set_parameter("hazard_id", hazard_id) | ||
bldg_dmg.set_parameter("num_cpu", 4) | ||
bldg_dmg.set_parameter("seed", 1000) | ||
bldg_dmg.run_analysis() | ||
|
||
|
||
if __name__ == '__main__': | ||
run_with_base_class() |
38 changes: 38 additions & 0 deletions
38
...s/pyincore/analyses/buildingstructuraldamage/test_buildingstructuraldamage_multihazard.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import os | ||
|
||
from pyincore import IncoreClient, FragilityService, MappingSet | ||
from pyincore.analyses.buildingstructuraldamage.buildingstructuraldamage import BuildingStructuralDamage | ||
import pyincore.globals as pyglobals | ||
|
||
|
||
def run_with_base_class(): | ||
client = IncoreClient(pyglobals.INCORE_API_DEV_URL) | ||
|
||
bldg_dmg = BuildingStructuralDamage(client) | ||
|
||
# seaside multi-hazard | ||
bldg_dmg.load_remote_input_dataset("buildings", "5bcf2fcbf242fe047ce79dad") | ||
|
||
mapping_id = "648a3f88c687ae511a1814e2" # earthquake+tsunami mapping | ||
fragility_service = FragilityService(client) | ||
mapping_set = MappingSet(fragility_service.get_mapping(mapping_id)) | ||
bldg_dmg.set_input_dataset('dfr3_mapping_set', mapping_set) | ||
bldg_dmg.set_parameter("fragility_key", "Non-Retrofit Fragility ID Code") | ||
|
||
hazard_type = "earthquake+tsunami" | ||
hazard_id = "5ba8f127ec2309043520906c+5bc9eaf7f7b08533c7e610e1" | ||
|
||
result_folder = "mutliple_hazards" | ||
if not os.path.exists(result_folder): | ||
os.mkdir(result_folder) | ||
result_name = os.path.join(result_folder, "seaside_multihazard") | ||
bldg_dmg.set_parameter("result_name", result_name) | ||
bldg_dmg.set_parameter("hazard_type", hazard_type) | ||
bldg_dmg.set_parameter("hazard_id", hazard_id) | ||
bldg_dmg.set_parameter("num_cpu", 4) | ||
bldg_dmg.set_parameter("seed", 1000) | ||
bldg_dmg.run_analysis() | ||
|
||
|
||
if __name__ == '__main__': | ||
run_with_base_class() |
Oops, something went wrong.