Skip to content

Commit 8dc806a

Browse files
committed
Extend rWHALE to only look for requested results.
rWHALE used to blindly try to open every type of result file, collect the information and then check what to save in the output. Instead, this commit adds code that checks what outputs are requested and utilizes the existing argument of aggregate_results to ask for only a subset of output types if that's what the user needs.
1 parent 23f1bd2 commit 8dc806a

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

modules/Workflow/rWHALE.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,28 @@ def main( # noqa: C901, D103
266266
comm.Barrier()
267267

268268
# aggregate results
269+
if inputs.get('outputs', False):
270+
requested_outputs = []
271+
for output_type in ['AIM', 'EDP', 'DM', 'DV']:
272+
if inputs['outputs'].get(output_type, False):
273+
if inputs['outputs'][output_type]:
274+
requested_outputs.append(output_type)
275+
else:
276+
requested_outputs = ['AIM', 'EDP', 'DM', 'DV']
277+
requested_outputs.append('every_realization')
278+
269279
if (
270280
asset_type == 'Buildings' # noqa: PLR1714
271281
or asset_type == 'TransportationNetwork'
272282
or asset_type == 'WaterDistributionNetwork'
273283
or asset_type == 'PowerNetwork'
274284
):
275285
if procID == 0:
276-
WF.aggregate_results(asst_data=asst_data, asset_type=asset_type)
286+
WF.aggregate_results(
287+
asst_data=asst_data,
288+
asset_type=asset_type,
289+
out_types = requested_outputs
290+
)
277291

278292
elif asset_type == 'WaterNetworkPipelines':
279293
# Provide the headers and out types

modules/Workflow/whale/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2944,8 +2944,7 @@ def aggregate_results( # noqa: C901, PLR0912, PLR0915
29442944
self,
29452945
asst_data,
29462946
asset_type='',
2947-
# out_types = ['IM', 'BIM', 'EDP', 'DM', 'DV', 'every_realization'],
2948-
out_types=['AIM', 'EDP', 'DMG', 'DV', 'every_realization'], # noqa: B006
2947+
out_types=['AIM', 'EDP', 'DM', 'DV', 'every_realization'], # noqa: B006
29492948
headers=None,
29502949
):
29512950
"""Short description

0 commit comments

Comments
 (0)