6
6
from numbers import Integral , Number
7
7
from operator import add
8
8
from typing import TYPE_CHECKING , Any , Sequence , Union
9
+ from warnings import warn
9
10
10
11
import numpy as np
11
12
import zarr
@@ -886,7 +887,8 @@ def reduction(
886
887
x : "Array" ,
887
888
func ,
888
889
combine_func = None ,
889
- aggegrate_func = None ,
890
+ aggegrate_func = None , # typo, will removed in next release
891
+ aggregate_func = None ,
890
892
axis = None ,
891
893
intermediate_dtype = None ,
892
894
dtype = None ,
@@ -896,12 +898,19 @@ def reduction(
896
898
extra_func_kwargs = None ,
897
899
) -> "Array" :
898
900
"""Apply a function to reduce an array along one or more axes."""
901
+ if aggegrate_func is not None and aggregate_func is None :
902
+ warn (
903
+ "`aggegrate_func` is deprecated, please use `aggregate_func` instead" ,
904
+ DeprecationWarning ,
905
+ stacklevel = 2 ,
906
+ )
907
+ aggregate_func = aggegrate_func
899
908
if use_new_impl :
900
909
return reduction_new (
901
910
x ,
902
911
func ,
903
912
combine_func ,
904
- aggegrate_func ,
913
+ aggregate_func ,
905
914
axis ,
906
915
intermediate_dtype ,
907
916
dtype ,
@@ -983,8 +992,8 @@ def reduction(
983
992
extra_func_kwargs = extra_func_kwargs ,
984
993
)
985
994
986
- if aggegrate_func is not None :
987
- result = map_blocks (aggegrate_func , result , dtype = dtype )
995
+ if aggregate_func is not None :
996
+ result = map_blocks (aggregate_func , result , dtype = dtype )
988
997
989
998
if not keepdims :
990
999
axis_to_squeeze = tuple (i for i in axis if result .shape [i ] == 1 )
@@ -1002,7 +1011,7 @@ def reduction_new(
1002
1011
x : "Array" ,
1003
1012
func ,
1004
1013
combine_func = None ,
1005
- aggegrate_func = None ,
1014
+ aggregate_func = None ,
1006
1015
axis = None ,
1007
1016
intermediate_dtype = None ,
1008
1017
dtype = None ,
@@ -1043,8 +1052,8 @@ def reduction_new(
1043
1052
)
1044
1053
1045
1054
# aggregate final chunks
1046
- if aggegrate_func is not None :
1047
- result = map_blocks (aggegrate_func , result , dtype = dtype )
1055
+ if aggregate_func is not None :
1056
+ result = map_blocks (aggregate_func , result , dtype = dtype )
1048
1057
1049
1058
if not keepdims :
1050
1059
axis_to_squeeze = tuple (i for i in axis if result .shape [i ] == 1 )
@@ -1213,7 +1222,7 @@ def arg_reduction(
1213
1222
out ,
1214
1223
_arg_func ,
1215
1224
combine_func = partial (_arg_combine , arg_func = arg_func ),
1216
- aggegrate_func = _arg_aggregate ,
1225
+ aggregate_func = _arg_aggregate ,
1217
1226
axis = axis ,
1218
1227
intermediate_dtype = intermediate_dtype ,
1219
1228
dtype = dtype ,
0 commit comments