diff --git a/xapres/utils.py b/xapres/utils.py index 78ac357..330def1 100644 --- a/xapres/utils.py +++ b/xapres/utils.py @@ -8,6 +8,8 @@ import numpy as np import xarray as xr import datetime +import dask.array as da + @@ -382,6 +384,9 @@ def freq2range(frequencies): # roll s_wpr = s_wp.roll(chirp_time=int(Nt*pad_factor/2)) + if contains_dask_array(s_wpr): + s_wpr = s_wpr.chunk({'chirp_time':-1}) + # fft S_wpr = xr.apply_ufunc(np.fft.fft, s_wpr, @@ -439,4 +444,7 @@ def add_methods_to_xarrays(): ds_methods = [addProfileToDs] for method in ds_methods: - setattr(xr.Dataset, method.__name__, method) \ No newline at end of file + setattr(xr.Dataset, method.__name__, method) + +def contains_dask_array(dataarray): + return isinstance(dataarray.data, da.Array) \ No newline at end of file