Skip to content

Commit 80e26c3

Browse files
committed
Merge branch 'develop' into release-1.22.0
2 parents d40c92f + e2e85c5 commit 80e26c3

File tree

22 files changed

+450
-23
lines changed

22 files changed

+450
-23
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010

1111
### Added
1212
- ML Enabled Galveston CGE [#641](https://github.com/IN-CORE/pyincore/issues/641)
13+
- Add ML enabled Seaside CGE [#657](https://github.com/IN-CORE/pyincore/issues/657)
1314

1415
### Changed
1516
- Descriptions of the analyses to be more verbose. [#645](https://github.com/IN-CORE/pyincore/issues/645)
1617
- Descriptions of the analyses, inputs and parameters. [#649](https://github.com/IN-CORE/pyincore/issues/649)
1718
- Descriptions of the analyses, inputs and parameters. [#646](https://github.com/IN-CORE/pyincore/issues/646)
1819
- Descriptions of the analyses to be more verbose. [#647](https://github.com/IN-CORE/pyincore/issues/647)
20+
- Hazard service earthquake post method to allow user to specify soil type dataset [#654](https://github.com/IN-CORE/pyincore/issues/654)
21+
- Capital Shocks analysis to also output Sectors in building to sector mappings with no guids as unit shocks. [#671](https://github.com/IN-CORE/pyincore/issues/671)
22+
23+
### Fixed
24+
- Building retrofit fails with local building dataset. [#617](https://github.com/IN-CORE/pyincore/issues/617)
25+
26+
### Fixed
27+
- Network analyses to check if a network dataset is set by the user. [#667](https://github.com/IN-CORE/pyincore/issues/667)
1928

2029

2130
## [1.21.0] - 2025-02-12

docs/source/modules.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ analyses/mlenabledcgejoplin
248248
.. autoclass:: mlenabledcgejoplin.mlcgejoplin.MlEnabledCgeJoplin
249249
:members:
250250

251+
analyses/mlenabledcgeseaside
252+
========================
253+
.. autoclass:: mlenabledcgeseaside.mlcgeseaside.MlEnabledCgeSeaside
254+
:members:
255+
251256
analyses/montecarlofailureprobability
252257
=====================================
253258
.. deprecated:: 1.19.0

pyincore/analyses/buildingstructuraldamage/buildingstructuraldamage.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ def building_damage_analysis_bulk_input(
186186
# Get geology dataset id containing liquefaction susceptibility
187187
geology_dataset_id = self.get_parameter("liquefaction_geology_dataset_id")
188188

189+
site_class_dataset_id = self.get_parameter("site_class_dataset_id")
190+
189191
multihazard_vals = {}
190192
adjust_demand_types_mapping = {}
191193

@@ -231,6 +233,10 @@ def building_damage_analysis_bulk_input(
231233
value_liq = {"demands": [""], "units": [""], "loc": loc}
232234
values_payload_liq.append(value_liq)
233235

236+
if hazard_type == "earthquake" and site_class_dataset_id is not None:
237+
# Add site class dataset id if set to get soil type information
238+
value = {"siteClassId": site_class_dataset_id}
239+
values_payload.append(value)
234240
hazard_vals = hazard.read_hazard_values(values_payload, self.hazardsvc)
235241

236242
# map demand type from payload to response
@@ -471,6 +477,12 @@ def get_spec(self):
471477
"description": "Liquefaction geology/susceptibility dataset id. If not provided, liquefaction will be ignored.",
472478
"type": str,
473479
},
480+
{
481+
"id": "site_class_dataset_id",
482+
"required": False,
483+
"description": "Site classification dataset id containing soil type information.",
484+
"type": str,
485+
},
474486
],
475487
"input_hazards": [
476488
{

pyincore/analyses/capitalshocks/capitalshocks.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,15 @@ def run(self):
109109
sector_values = inventory_failure.loc[
110110
(inventory_failure["sector"] == sector)
111111
]
112-
sector_cap = sector_values["cap_rem"].sum()
113-
sector_total = sector_values["appr_bldg"].sum()
114-
if sector_total == 0:
115-
continue
116-
sector_shock = np.divide(sector_cap, sector_total)
117-
sector_shocks[sector] = sector_shock
118-
112+
if sector_values.empty:
113+
sector_shocks[sector] = 1.0
114+
else:
115+
sector_cap = sector_values["cap_rem"].sum()
116+
sector_total = sector_values["appr_bldg"].sum()
117+
if sector_total == 0:
118+
continue
119+
sector_shock = np.divide(sector_cap, sector_total)
120+
sector_shocks[sector] = sector_shock
119121
sector_shocks = pd.DataFrame(sector_shocks.items(), columns=["sector", "shock"])
120122
result_name = self.get_parameter("result_name")
121123
self.set_result_csv_data(

pyincore/analyses/epnfunctionality/epnfunctionality.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ def run(self):
2626
"""Execute electric power facility functionality analysis"""
2727

2828
# get network dataset
29-
network_dataset = NetworkDataset.from_dataset(
30-
self.get_input_dataset("epn_network")
31-
)
29+
network_dataset = self.get_input_dataset("epn_network")
30+
if not isinstance(network_dataset, NetworkDataset):
31+
network_dataset = NetworkDataset.from_dataset(
32+
self.get_input_dataset("epn_network")
33+
)
34+
3235
links_epl_gdf = network_dataset.links.get_dataframe_from_shapefile()
3336
nodes_epf_gdf = network_dataset.nodes.get_dataframe_from_shapefile()
3437
links_epl_gdf["weight"] = links_epl_gdf.loc[:, "length_km"]
@@ -181,9 +184,9 @@ def get_spec(self):
181184
return {
182185
"name": "epn-functionality",
183186
"description": "This analysis computes the functionality of electric power networks. The computation uses "
184-
"sample failure states as well as the network topology of electric power line to determine "
185-
"the functionality probability and failure states for a corresponding electric power "
186-
"facility network by performing a reachability analysis.",
187+
"sample failure states as well as the network topology of electric power line to determine "
188+
"the functionality probability and failure states for a corresponding electric power "
189+
"facility network by performing a reachability analysis.",
187190
"input_parameters": [
188191
{
189192
"id": "result_name",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"Testbed","Hazard","Model_Type","Model_Name","(Intercept)","CONST","RETAIL","SERV","HEALTH","ACCOM","REST","AG","MANUF","UTIL","HS"
2+
"Seaside","earthquake/tsunami","main_model","totDDS","-12959.6812401795","-0.102683842406043","-0.257586194071901","-0.276907455793166","-0.151581519250078","-0.139119274930815","-0.37961877913442","0","-0.171623044649421","0","-1.43678350054981"
3+
"Seaside","earthquake/tsunami","sector_model","DDS _ CONST","-3533.43116979413","-0.43206079059629","-0.0254795553612004","-0.00316163877636667","0.0332152210180423","-0.069779780908355","0.00358441265154825","0.145134980251205","-0.0312337980035751","0.144597778469588","-0.0184301835616176"
4+
"Seaside","earthquake/tsunami","sector_model","DDS _ RETAIL","159.384175863132","-0.00911826545672146","-0.173416020081555","-0.00784416392638722","0.00164261000863743","-0.00334997632478147","-0.031014838822876","-0.0158218901058329","-0.0290538716968224","0.0466227452944628","-0.0298089583963744"
5+
"Seaside","earthquake/tsunami","sector_model","DDS _ SERV","1093.12126496221","0.0252925121970897","-0.0113694501554157","-0.24748182103426","0.00774803544581237","0.0061975397852887","-0.0173356071468042","0","-0.0126204394013267","0.096271756492028","-0.0385780663819925"
6+
"Seaside","earthquake/tsunami","sector_model","DDS _ HEALTH","626.0009743808","0.0280255963337468","-0.0115125749342947","-0.0162816863436473","-0.307635941425662","0.0108491698024404","-0.0229929582544053","0","-0.0159749366933287","0.0933692152077911","-0.0346851656342127"
7+
"Seaside","earthquake/tsunami","sector_model","DDS _ ACCOM","-322.81364250883","0","-0.000804263359449657","-0.000166637751696191","0","-0.113496137388284","-0.00371697981044756","0","0","0","-0.00180248064974006"
8+
"Seaside","earthquake/tsunami","sector_model","DDS _ REST","484.100271348851","0","-0.014355564760606","-0.00695376082286088","-0.00800336657815068","-0.00444392970298923","-0.361521166188126","0","-0.00550211221863404","0.00818253796908566","-0.0284308740310688"
9+
"Seaside","earthquake/tsunami","sector_model","DDS _ AG","58.9128781272464","0.000229889114733221","-0.00272598798461285","-0.00153840358020596","0.00247678052482344","0.00141539481608571","-0.000382933145170849","-0.207360170792837","-0.0050078463127264","0.00502532392956314","-0.00292672318759572"
10+
"Seaside","earthquake/tsunami","sector_model","DDS _ MANUF","835.992430317183","-0.00931204109143912","-0.0573209900525293","-0.0136989783316526","0.0157994140628598","0.0123691633792208","-0.0134947468001798","-0.0786865099882939","-0.268095564477591","0.118648510360117","-0.0234987630116343"
11+
"Seaside","earthquake/tsunami","sector_model","DDS _ UTIL","58.9326167438378","0.00255067719163619","0.000109034043934701","-0.000497739356472602","0.00226546120802633","0.0016725859848199","0.000824692893526063","0","-0.000459267623749738","-0.368770363353376","-0.00214094413297836"
12+
"Seaside","earthquake/tsunami","sector_model","DDS _ HS","-5373.6948212898","0","0","0","0","0","0","0","0","0","-1.25307960573289"

0 commit comments

Comments
 (0)