@@ -518,8 +518,8 @@ def _pick_second(*x):
518518
519519first = Aggregation ("first" , chunk = None , combine = None , fill_value = 0 )
520520last = Aggregation ("last" , chunk = None , combine = None , fill_value = 0 )
521- nanfirst = Aggregation ("nanfirst" , chunk = "nanfirst" , combine = " nanfirst" , fill_value = np .nan )
522- nanlast = Aggregation ("nanlast" , chunk = "nanlast" , combine = " nanlast" , fill_value = np .nan )
521+ nanfirst = Aggregation ("nanfirst" , chunk = "nanfirst" , combine = xrutils . nanfirst , fill_value = np .nan )
522+ nanlast = Aggregation ("nanlast" , chunk = "nanlast" , combine = xrutils . nanlast , fill_value = np .nan )
523523
524524all_ = Aggregation (
525525 "all" ,
@@ -577,8 +577,8 @@ def topk_new_dims_func(k) -> tuple[Dim]:
577577topk = Aggregation (
578578 name = "topk" ,
579579 fill_value = dtypes .NINF ,
580- chunk = None ,
581- combine = None ,
580+ chunk = "topk" ,
581+ combine = xrutils . topk ,
582582 final_dtype = None ,
583583 new_dims_func = topk_new_dims_func ,
584584)
@@ -881,10 +881,7 @@ def _initialize_aggregation(
881881 simple_combine : list [Callable | None ] = []
882882 for combine in agg .combine :
883883 if isinstance (combine , str ):
884- if combine in ["nanfirst" , "nanlast" ]:
885- simple_combine .append (getattr (xrutils , combine ))
886- else :
887- simple_combine .append (getattr (np , combine ))
884+ simple_combine .append (getattr (np , combine ))
888885 else :
889886 simple_combine .append (combine )
890887
0 commit comments