From f18af38dc673d06ac380a345ab425140db2647f7 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Wed, 4 Sep 2024 17:30:43 +0200 Subject: [PATCH] reordered operations --- dap/algos/aggregation.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/dap/algos/aggregation.py b/dap/algos/aggregation.py index f7d3e71..6281fbc 100644 --- a/dap/algos/aggregation.py +++ b/dap/algos/aggregation.py @@ -3,11 +3,18 @@ from .thresh import threshold def calc_apply_aggregation(results, data, pixel_mask_pf, aggregator): + # last round was ready, restart + if aggregator.is_ready(): + aggregator.reset() + calc_apply_threshold(results, data) # changes data in place data = calc_aggregate(results, data, aggregator) calc_mask_pixels(data, pixel_mask_pf) # changes data in place - aggregation_ready = calc_aggregation_ready(results, aggregator) - return data, aggregation_ready + + aggregator.nmax = results.get("aggregation_max") + aggregation_is_ready = aggregator.is_ready() + + return data, aggregation_is_ready @@ -50,14 +57,3 @@ def calc_aggregate(results, data, aggregator): -def calc_aggregation_ready(results, aggregator): - aggregator.nmax = results.get("aggregation_max") - - if not aggregator.is_ready(): - return False - - aggregator.reset() - return True - - -