Skip to content

Commit 811f8a8

Browse files
navarroclongshuicy
andauthored
Fixes #617 - Building retrofit fails with local building dataset because the dataset id is a path for local datasets (#669)
Co-authored-by: Chen Wang <cwang138@illinois.edu>
1 parent 060a239 commit 811f8a8

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ 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)
@@ -18,8 +19,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1819
- Descriptions of the analyses to be more verbose. [#647](https://github.com/IN-CORE/pyincore/issues/647)
1920
- Hazard service earthquake post method to allow user to specify soil type dataset [#654](https://github.com/IN-CORE/pyincore/issues/654)
2021

21-
### Added
22-
- Add ML enabled Seaside CGE [#657](https://github.com/IN-CORE/pyincore/issues/657)
22+
### Fixed
23+
- Building retrofit fails with local building dataset. [#617](https://github.com/IN-CORE/pyincore/issues/617)
2324

2425

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

pyincore/utils/datasetutil.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# for evaluation of retrofit expression
1414
import math # noqa: F401
1515
import scipy # noqa: F401
16+
import os
1617

1718

1819
class DatasetUtil:
@@ -196,7 +197,12 @@ def _apply_retrofit_value(row):
196197

197198
# save the updated inventory to a new shapefile
198199
tmpdirname = tempfile.mkdtemp()
199-
file_path = f"{tmpdirname}/tmp_updated_{inventory_dataset.id}.shp"
200+
201+
inventory_dataset_id = inventory_dataset.id
202+
# Check if inventory ID is a file path and if it is, just use the base name
203+
if os.path.isdir(inventory_dataset_id):
204+
inventory_dataset_id = os.path.basename(inventory_dataset_id)
205+
file_path = f"{tmpdirname}/tmp_updated_{inventory_dataset_id}.shp"
200206
inventory_df.to_file(file_path)
201207

202208
# return the updated inventory dataset in geoDataframe for future consumption

0 commit comments

Comments
 (0)