From 1ea83f81b9c13d65cb6327a3d460c8cac1b82620 Mon Sep 17 00:00:00 2001 From: TatianaBurek Date: Fri, 13 Oct 2023 14:51:39 -0600 Subject: [PATCH] loop over statistics only once to avoid data multiplication #330 --- metcalcpy/util/utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/metcalcpy/util/utils.py b/metcalcpy/util/utils.py index c8b99616..5fb9b7c1 100644 --- a/metcalcpy/util/utils.py +++ b/metcalcpy/util/utils.py @@ -691,7 +691,14 @@ def equalize_axis_data(fix_vals_keys, fix_vals_permuted, params, input_data, axi for fcst_var, fcst_var_stats in fcst_var_val.items(): series_data_for_ee = pd.DataFrame() - for fcst_var_stat in fcst_var_stats: + fcst_var_stats_current = fcst_var_stats + # if the data comes from agg_stat workflow it doesn't contain statistics values. + # They will be calculated later. In this case The code should not loop over all + # requested statistics but instead should do it only ones to avoid data multiplication + if 'stat_name' not in input_data.keys(): + fcst_var_stats_current = [fcst_var_stats[0]] + + for fcst_var_stat in fcst_var_stats_current: # for each series for the specified axis if len(params['series_val_' + axis]) == 0: series_data_for_ee = input_data