hippalectryon-0 / xr-scipy

scipy for xarray eco-system
http://xr-scipy.readthedocs.io
61 stars 9 forks source link

Trouble with the fft module #53

Open serie-python-tele opened 2 weeks ago

serie-python-tele commented 2 weeks ago

Hello,

I'm having trouble running your example with python 3.10:

      1 import xrscipy
      2 arr = xr.DataArray(np.sin(np.linspace(0, 15.7, 30)) ** 2,
      3                    dims=('x'), coords={'x': np.linspace(0, 5, 30)})
----> 4 fft = xrscipy.fft.fft(arr, 'x')
      5 #fft = scipy.fft.fft(arr.data)
      7 plt.figure(figsize=(10, 4))

AttributeError: module 'xrscipy' has no attribute 'fft'

Thank you,

Samuel

serie-python-tele commented 2 weeks ago

Ok, solved it

import xrscipy.fft as fft
arr = xr.DataArray(np.sin(np.linspace(0, 15.7, 30)) ** 2,
                   dims=('x'), coords={'x': np.linspace(0, 5, 30)})
fft = fft.fft(arr, 'x')