NEDAS.utils.fft_lib module
- NEDAS.utils.fft_lib.fft2(f: ndarray) ndarray[source]
2D FFT implemented by pyFFTW. If pyFFTW is not available, will switch to np.fft.fft2
- Parameters:
f (np.ndarray) – Input field, of shape (…, ny, nx), of float32 type, the last two dimensions will be transformed by the 2D FFT.
- Returns:
Output field in spectral space, of complex64 type.
- Return type:
np.ndarray
- NEDAS.utils.fft_lib.ifft2(fh: ndarray) ndarray[source]
Inverse 2D FFT implemented by pyFFTW. If pyFFTW is not available, will switch to np.fft.ifft2
- Parameters:
fh (np.ndarray) – Input field, of shape (…, nky, nkx), of complex64 type, the last two dimensions will be inverse transformed by 2D FFT.
- Returns:
Output field in physical space, of float32 type.
- Return type:
np.ndarray
- NEDAS.utils.fft_lib.fftwn(n)[source]
Wavenumber sequence corresponding to the FFT output in 1 dimension.
- Parameters:
n (int) – The size of the dimension
- Returns:
The sequence of wavenumber (0,1,2,…-2,-1) for this dimension
- Return type:
np.ndarray
- NEDAS.utils.fft_lib.get_wn(fld)[source]
Generates a meshgrid of wavenumbers corresponding to the input field dimensions.
- Parameters:
fld (np.ndarray) – Input field, the last two dimensions are the horizontal directions (ny, nx)
- Returns:
Wavenumbers corresponding to the input fields dimensions, relative to the domain size (nx or ny, whichever is larger).
- Return type:
np.ndarray