From 4206f7ffc0135261c5b453de7cf091fceec345a6 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Sat, 29 Aug 2020 00:31:19 +0000 Subject: [PATCH] Fixes passing tuple or list for weights --- Lib/averager.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Lib/averager.py b/Lib/averager.py index 196726f..d261ee5 100644 --- a/Lib/averager.py +++ b/Lib/averager.py @@ -442,7 +442,7 @@ def __check_weightoptions(x, axisoptions, weightoptions): if __DEBUG__: print('axislist = ', axislist) # - if not isinstance(weightoptions, list): + if not isinstance(weightoptions, (list, tuple)): # # We have either 1 axis only or multiple axes and one MV2 of weights # @@ -490,6 +490,11 @@ def __check_weightoptions(x, axisoptions, weightoptions): # # We have multiple axes to deal with each with a weight.... # + + # Ensure we have a mutable list, handles tuple (https://github.com/CDAT/genutil/issues/32 + if not isinstance(weightoptions, list): + weightoptions = list(weightoptions) + for i in range(len(axislist)): weightoptions[i] = __check_each_weight_option( x, axislist[i], axisindex[i], weightoptions[i])