-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance tuning for building damage (#516)
* improve or_matched; add slc test * improve payload loop * remove keys() as not needed * remove keys to speed up * speed up using pre-filter on mapped/unmapped buildings * improve lens * Added cache to store fragility matches and the inventory attributes s… (#517) * Added cache to store fragility matches and the inventory attributes so like structures can pull from the cache * Add caching for both new and old rule sets * Updated to handle both old and new rule parsing when building the cache * Update CHANGELOG.md * Updated caching to consider the retrofit_key entry when matching the cache --------- Co-authored-by: Chris Navarro <cmnavarr@illinois.edu>
- Loading branch information
Showing
5 changed files
with
215 additions
and
78 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
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
36 changes: 36 additions & 0 deletions
36
tests/pyincore/analyses/buildingdamage/test_slc_buildingdamage.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,36 @@ | ||
from pyincore import IncoreClient, FragilityService, MappingSet, Earthquake, HazardService, DataService | ||
from pyincore.analyses.buildingdamage import BuildingDamage | ||
import time | ||
|
||
|
||
if __name__ == "__main__": | ||
client = IncoreClient() | ||
|
||
# Initiate fragility service | ||
fragility_services = FragilityService(client) | ||
hazard_services = HazardService(client) | ||
data_services = DataService(client) | ||
|
||
# Analysis setup | ||
start_time = time.time() | ||
bldg_dmg = BuildingDamage(client) | ||
|
||
mapping_set = MappingSet(fragility_services.get_mapping("6309005ad76c6d0e1f6be081")) | ||
bldg_dmg.set_input_dataset('dfr3_mapping_set', mapping_set) | ||
|
||
bldg_dmg.load_remote_input_dataset("buildings", "62fea288f5438e1f8c515ef8") # Salt Lake County All Building | ||
bldg_dmg.set_parameter("result_name", "SLC_bldg_dmg_no_retrofit-withLIQ7.1") | ||
|
||
eq = Earthquake.from_hazard_service("640a03ea73a1642180262450", hazard_services) # Mw 7.1 | ||
# eq = Earthquake.from_hazard_service("64108b6486a52d419dd69a41", hazard_services) # Mw 7.0 | ||
bldg_dmg.set_input_hazard("hazard", eq) | ||
|
||
bldg_dmg.set_parameter("use_liquefaction", True) | ||
bldg_dmg.set_parameter("liquefaction_geology_dataset_id", "62fe9ab685ac6b569e372429") | ||
bldg_dmg.set_parameter("num_cpu", 8) | ||
|
||
# Run building damage without liquefaction | ||
bldg_dmg.run_analysis() | ||
|
||
end_time = time.time() | ||
print(f"total runtime: {end_time - start_time}") |