From 53b42a1736f6ae43194e47cad33cef3868b4d579 Mon Sep 17 00:00:00 2001 From: vikineema Date: Wed, 16 Oct 2024 00:25:16 +0300 Subject: [PATCH] Fix parallel_apply --- Tools/deafrica_tools/datahandling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/deafrica_tools/datahandling.py b/Tools/deafrica_tools/datahandling.py index bacb931df..6439d3aba 100644 --- a/Tools/deafrica_tools/datahandling.py +++ b/Tools/deafrica_tools/datahandling.py @@ -1025,7 +1025,7 @@ def parallel_apply(ds, dim, func, *args): with ProcessPoolExecutor() as executor: # Apply func in parallel - groups = [group for (i, group) in ds.groupby(dim)] + groups = [group.squeeze(dim=dim) for (i, group) in ds.groupby(dim)] to_iterate = (groups, *(repeat(i, len(groups)) for i in args)) out_list = list(tqdm(executor.map(func, *to_iterate), total=len(groups)))