From 12fbe9a2aec1d009e97a03bf98d25dcf25d12b76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Le=20Guyader?= <loic.le.guyader@xfel.eu>
Date: Wed, 9 Feb 2022 17:27:43 +0100
Subject: [PATCH] Fix change in dask groupby not droping dimension

---
 doc/Dask DSSC module binning.ipynb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/Dask DSSC module binning.ipynb b/doc/Dask DSSC module binning.ipynb
index 131660c..4a75edb 100644
--- a/doc/Dask DSSC module binning.ipynb	
+++ b/doc/Dask DSSC module binning.ipynb	
@@ -190,7 +190,8 @@
     "        # https://github.com/pydata/xarray/issues/2028\n",
     "        sub_r = r.sel(sa3_pId=(r.pp == p))\n",
     "        \n",
-    "        res = sub_r.groupby('bin_'+xaxis).mean()\n",
+    "        # calculate mean on bin, then mean to remove the dimension\n",
+    "        res = sub_r.groupby('bin_'+xaxis).mean().mean(['sa3_pId'])\n",
     "\n",
     "        if bin_data is None:\n",
     "            bin_data = res\n",
-- 
GitLab