# [ncl-talk] some clarifications on fft2df function

Guido Cioni guidocioni at gmail.com
Wed Mar 8 08:24:56 MST 2017

```Hi all,
I'm trying to perform a spectral analysis of surface fluxes (mainly sensible heat) in order to identify spatial scales of surface heterogeneity [Baidya Roy et al., 2003]. In order to test the method I'm first using idealized simulations where the heterogeneity is prescribed with one dry and one wet patch aligned in the x-dimension with very different fluxes. What I'd expect to find in this case is a peak at the scale of ~100km, which is the size of the patch.

I've been trying to use the fft2df function, but the documentation is pretty limited, so that's why I'm asking here. The idea is to go from sensible heat flux, shfl_s(time, lat, lon), to the Fourier transform F(lhfl_s)(time, k_lat, k_lon) and then somehow collapse the 2-D DFT into a one-dimensional by averaging. Since the idealized domain is limited but with periodic boundary conditions I don't think that tapering would be necessary.

So I first apply

coef:=fft2df(shfl_s(:,:))
coefmod:=sqrt(coef(0,:,:)^2+coef(1,:,:)^2)
spectrum=dim_avg_n_Wrap(coefmod, 0)

I believe that fft2df is returning the real and imaginary part of the Fourier transform, so that I have to compute the absolute value and then an average to get rid of the y-coordinate, which is useless given the heterogeneity gradient in my case is everywhere parallel to the x-axis. Is the procedure correct?
I get a spectrum which is something like that (don't mind the x-axis...), but I would have expected something different...

Guido Cioni
http://guidocioni.altervista <http://guidocioni.altervista/>.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170308/b2a52948/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2017-03-08 at 16.23.22.png
Type: image/png
Size: 51828 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170308/b2a52948/attachment.png
```