Skip to content

Commit 4793279

Browse files
committed
Fix GeoJSON to ASSET file path on DesignSafe
1 parent c3529b4 commit 4793279

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

modules/Workflow/WorkflowApplications.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"ExecutablePath": "applications/createAIM/GeoJSON_to_ASSET/GeoJSON_to_ASSET.py",
8383
"ApplicationSpecificInputs": [
8484
{
85-
"id": "assetFile",
85+
"id": "assetSourceFile",
8686
"type": "path",
8787
"description": "path to asset database file"
8888
},

modules/createAIM/GeoJSON_to_ASSET/GeoJSON_to_ASSET.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,8 @@ def defineConnectivities(self, AIM_id_prefix = None, edges_file_name = None,\
193193
self.gdf = edges
194194
return
195195

196-
def split_and_select_components(input_config):
196+
def split_and_select_components(input_config, asset_source_file):
197197
component_dict = dict()
198-
asset_source_file = input_config["assetSourceFile"]
199198
with open(asset_source_file, 'r', encoding="utf-8") as f:
200199
source_data = json.load(f)
201200
crs = source_data["crs"]
@@ -251,7 +250,7 @@ def init_workdir(component_dict, outDir):
251250
component_dir.update({comp:compDir})
252251
return component_dir
253252

254-
def create_asset_files(output_file,
253+
def create_asset_files(output_file, asset_source_file,
255254
asset_type, input_file, doParallel):
256255
# check if running parallel
257256
numP = 1
@@ -281,7 +280,9 @@ def create_asset_files(output_file,
281280
["ApplicationData"]
282281
# if input_config.get("Roadway", None):
283282
# roadSegLength = float(input_config['Roadway'].get('maxRoadLength_m', "100000"))
284-
component_dict = split_and_select_components(input_config)
283+
284+
# assetSourceFile passed through command may be different from input_config when run on designsafe
285+
component_dict = split_and_select_components(input_config, asset_source_file)
285286
component_dir = init_workdir(component_dict, outDir)
286287
assets_array = []
287288
for component_type, component_data in component_dict.items():
@@ -341,6 +342,7 @@ def create_asset_files(output_file,
341342

342343
parser = argparse.ArgumentParser()
343344
parser.add_argument('--assetFile')
345+
parser.add_argument('--assetSourceFile')
344346
parser.add_argument('--assetType')
345347
parser.add_argument('--inputJsonFile')
346348
parser.add_argument('--doParallel', default="False")
@@ -350,7 +352,8 @@ def create_asset_files(output_file,
350352
args = parser.parse_args()
351353

352354
if args.getRV:
353-
sys.exit(create_asset_files(args.assetFile, args.assetType,\
355+
sys.exit(create_asset_files(args.assetFile, args.assetSourceFile,\
356+
args.assetType,\
354357
args.inputJsonFile, args.doParallel))
355358
else:
356359
pass # not used

0 commit comments

Comments
 (0)