From 0394f06b5d50cc94ed316fde88c581b156d8d6f9 Mon Sep 17 00:00:00 2001 From: e-koch Date: Fri, 5 Jan 2024 16:26:25 -0500 Subject: [PATCH] Don't start a dask client as a kwarg --- spectral_cube/cube_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spectral_cube/cube_utils.py b/spectral_cube/cube_utils.py index 1eeea0eea..829faa2aa 100644 --- a/spectral_cube/cube_utils.py +++ b/spectral_cube/cube_utils.py @@ -926,7 +926,7 @@ def mosaic_cubes(cubes, spectral_block_size=100, combine_header_kwargs={}, fail_if_cube_dropped=False, fail_if_channel_empty=True, return_footprint=False, - client=Client(), + client=None, **kwargs): ''' This function reprojects cubes onto a common grid and combines them to a single field. @@ -1268,6 +1268,10 @@ def two_closest_channels(cube, channel): # theory; the previous would treat each cube in serial) datas = [cube._get_filled_data() for cube in scubes] wcses = [cube.wcs for cube in scubes] + + if client is None: + client = Client() + with client: datas = client.gather(datas) hdus = list(zip(datas, wcses))