I am sharing a snippet of code showing how the wavelet transform function from clouddrift can be used with xarray dataarrays. It doesn't work directly because of the np.moveaxis function to start with. The proposed solution is to use xr.apply_ufunc, which seems to work with dask arrays as well. A remaining issue that I have not solved is that I would like to use morse_wavelet then wavelet_transform in order to calculate the wavelet only once in this case of time series of common length, instead of using morse_wavelet_transform which calculates the wavelet for each iteration, so not necessarily efficient.
I am sharing a snippet of code showing how the wavelet transform function from clouddrift can be used with xarray dataarrays. It doesn't work directly because of the
np.moveaxis
function to start with. The proposed solution is to usexr.apply_ufunc
, which seems to work with dask arrays as well. A remaining issue that I have not solved is that I would like to usemorse_wavelet
thenwavelet_transform
in order to calculate the wavelet only once in this case of time series of common length, instead of usingmorse_wavelet_transform
which calculates the wavelet for each iteration, so not necessarily efficient.https://gist.github.com/selipot/93c061f7715b95ce3ec3bcf169c1165a
I'd like to discuss!