question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dft working with dask but not withouth

See original GitHub issue

The following works:

import numpy as np
import xarray as xr
import xrft

ds = xr.Dataset(coords={'time': ('time', np.arange(3000)*3600.), 'depth': ('depth', np.arange(10))})
ds = ds.assign(u=np.cos(2.*np.pi*2/86400.*ds.time)+0.*ds.depth)

ds = ds.chunk({'depth': 1})
u_fft = xrft.dft(ds.u.fillna(0.), dim=['time'], shift=False, detrend='linear', window=True)
print(u_fft.values)

But turning off chunking does not work:

import numpy as np
import xarray as xr
import xrft

ds = xr.Dataset(coords={'time': ('time', np.arange(3000)*3600.), 'depth': ('depth', np.arange(10))})
ds = ds.assign(u=np.cos(2.*np.pi*2/86400.*ds.time)+0.*ds.depth)

#ds = ds.chunk({'depth': 1})
u_fft = xrft.dft(ds.u.fillna(0.), dim=['time'], shift=False, detrend='linear', window=True)
print(u_fft.values)

And leads to:

(equinox) r2i2n0 datahome/aponte% python test_rft.py
Traceback (most recent call last):
  File "test_rft.py", line 9, in <module>
    u_fft = xrft.dft(ds.u.fillna(0.), dim=['time'], shift=False, detrend='linear', window=True)
  File "/home1/datahome/aponte/xrft/xrft/xrft.py", line 238, in dft
    da = _apply_detrend(da, axis_num)
  File "/home1/datahome/aponte/xrft/xrft/xrft.py", line 156, in _apply_detrend
    da = detrendn(da, axes=axis_num)
  File "/home1/datahome/aponte/xrft/xrft/xrft.py", line 100, in detrendn
    raise NotImplementedError("Detrending over more than 4 axes is "
NotImplementedError: Detrending over more than 4 axes is not implemented.

This looks like a bug but I could not decipher xrft enough in order to fix it.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rabernatcommented, Apr 5, 2019

It’s great when bugs fix themselves! 😄

1reaction
roxyboycommented, Apr 5, 2019

I’m going to close this issue since the current version of xrft doesn’t seem to produce this error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dask Best Practices - Dask documentation
This is a short overview of Dask best practices. This document specifically focuses on best practices that are shared among all of the...
Read more >
dask.array.fft.rfft
This function computes the one-dimensional n-point discrete Fourier Transform (DFT) of a real-valued array by means of an efficient algorithm called the Fast ......
Read more >
Best Practices - Dask documentation
It is easy to get started with Dask delayed, but using it well does require some experience. This page contains suggestions for best...
Read more >
dask.array.fft. - Dask documentation
FFT (Fast Fourier Transform) refers to a way the discrete Fourier Transform (DFT) can be calculated efficiently, by using symmetries in the calculated...
Read more >
Dask DataFrames Best Practices
It has a schema, and so there's no ambiguity about what types the columns are. This avoids confusing errors. It supports more advanced...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found