From 3f7825aacfeddd8d79bff6f5a3ec02305b109dd6 Mon Sep 17 00:00:00 2001 From: Alexey Pechnikov Date: Sun, 1 Dec 2024 00:21:26 +0700 Subject: [PATCH] Use compute() for unstacking in deco=imator as lazy data processing can be slow in some Dask versions --- pygmtsar/pygmtsar/Stack_multilooking.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pygmtsar/pygmtsar/Stack_multilooking.py b/pygmtsar/pygmtsar/Stack_multilooking.py index 1fbbbbb..f39140c 100644 --- a/pygmtsar/pygmtsar/Stack_multilooking.py +++ b/pygmtsar/pygmtsar/Stack_multilooking.py @@ -76,9 +76,10 @@ def decimator(da): warnings.filterwarnings('ignore') warnings.filterwarnings('ignore', module='dask') warnings.filterwarnings('ignore', module='dask.core') - # iunstack data if needed + # unstack data if needed if 'stack' in da.dims: - da = da.unstack('stack') + # .unstack() is too slow on lazy grids in some of Xarray/Dask versions + da = da.compute().unstack('stack') # workaround for Google Colab when we cannot save grids with x,y coordinate names # also supports geographic coordinates yname = [varname for varname in ['y', 'lat', 'a'] if varname in da.dims][0]