From 89a6a44a8fe70ef3f2fac432740532683adcdaed Mon Sep 17 00:00:00 2001 From: mKlapwijk Date: Mon, 2 Sep 2024 16:35:14 +0200 Subject: [PATCH] correct extraction of variables, bed, water level and interfaces --- .../entities/rules/depth_average_rule.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/decoimpact/business/entities/rules/depth_average_rule.py b/decoimpact/business/entities/rules/depth_average_rule.py index bda4d4a9..dd812301 100644 --- a/decoimpact/business/entities/rules/depth_average_rule.py +++ b/decoimpact/business/entities/rules/depth_average_rule.py @@ -45,14 +45,14 @@ def execute( """ # The first DataArray in our value_arrays contains the values to be averaged - # but the name of the key is given by the user, and is unknown here, so - # just use the first value. - iterator_input_values = iter(value_arrays.values()) - - variables = next(iterator_input_values) - bed_level_values = next(iterator_input_values) - water_level_values = next(iterator_input_values) - depths_interfaces = next(iterator_input_values) + # but the name of the key is given by the user, and is unknown here, so use + # the ordering defined in the parser. + values_list = list(value_arrays.values()) + + variables = values_list[0] + bed_level_values = values_list[1] + water_level_values = values_list[2] + depths_interfaces = values_list[3] # Get the dimension names for the interfaces and for the layers dim_interfaces_name = list(depths_interfaces.dims)[0]