# [ncl-talk] Fourier decompose

Soma Roy somaroy892 at gmail.com
Fri Feb 22 09:02:33 MST 2019

```Glad to know.
Many thanks Dennis.

Soma

On Fri, Feb 22, 2019, 21:09 Dennis Shea <shea at ucar.edu wrote:

> *Please do not send direct emails to people. Only to ncl-talk.*
>
> If  "X" is the data then how can we use it?
>
> X (ntime, nlat, nlon).
>
> Output result matrix should be same as X.
> ==============
>
> *As noted in the documentation, *the function is prototyped as
> 2-dimensional
>
> *function fft2df ( x [*][*])*
>
> As I said, you must use a do loop. It is user (your) responsibility to do
> any book keepind [savinh]
>
>  ntim = 8
>   nlat = 6
>   mlon = 8
>   x = *random_normal* <http://www.ncl.ucar.edu/Document/Functions/Built-in/random_normal.shtml>( 10, 5, (/ntim,nlat,mlon/) )
>   xNew = new( *dimsizes*(x), "float")
>
>   do nt=0,ntim-1
>                                                       ; ANALYSIS
>      coef = *fft2df* (x(nt,:,:_)              ; *coef:  [2] x [6] x [5] ;     [2] x [nlat] x [mlon/2+1]*
>
> ; do something with coef *<== *YOUR* responsibility*
>
>       xNew(nt,:,:) = *fft2db* <http://www.ncl.ucar.edu/Document/Functions/Built-in/fft2db.shtml> (coef)          ; SYNTHESIS
>
>   end do
>
> Please do not use this if you do not know how to use 2D FFT output.
> ncl-talk can not become your programmer.
>
>  Again, as noted in the function documentation, a readable introduction to 2D-FFT is at:
>  *http://www.dspguide.com/pdfbook.htm* <http://www.dspguide.com/pdfbook.htm>
> ===
> As noted in the documentation, NCL uses*  FFTPACK5 <https://www2.cisl.ucar.edu/resources/legacy/fft5> *developed by Paul Swarztrauber and Richard Valent.
> The specific Fortran subroutines used are:
> *      fft2df:
>        http://www2.cisl.ucar.edu/resources/legacy/fft5/documentation#rfft2f.html <http://www2.cisl.ucar.edu/resources/legacy/fft5/documentation#rfft2f.html>
>
>        fft2db:
>        http://www2.cisl.ucar.edu/resources/legacy/fft5/documentation#rfft2b.html <http://www2.cisl.ucar.edu/resources/legacy/fft5/documentation#rfft2b.html>
> *
>
>
> On Fri, Feb 22, 2019 at 8:06 AM Soma Roy <somaroy892 at gmail.com> wrote:
>
>> If "X" is the data then how can we use it?
>>
>> X (ntime, nlat, nlon).
>>
>> Output result matrix should be same as X.
>>
>> Soma
>>
>>
>> On Fri, Feb 22, 2019, 20:24 Dennis Shea <shea at ucar.edu wrote:
>>
>>> Please look at NCL's function documentation
>>>
>>>
>>> *http://www.ncl.ucar.edu/Document/Functions/Built-in/fft2df.shtml
>>> <http://www.ncl.ucar.edu/Document/Functions/Built-in/fft2df.shtml>
>>> <http://goog_952811495>*
>>> *http://www.ncl.ucar.edu/Document/Functions/Built-in/fft2db.shtml*
>>> <http://www.ncl.ucar.edu/Document/Functions/Built-in/fft2db.shtml>
>>>
>>> You will have to loop over each time step.
>>>
>>>
>>>
>>> On Fri, Feb 22, 2019 at 12:09 AM Soma Roy <somaroy892 at gmail.com> wrote:
>>>
>>>> Hello,
>>>> I have a time series data (ntime, nlat, nlon) in spatial domain. I want
>>>> to calculate fourier decomposition of the same over lat lon.
>>>> How to do it using ncl? Is there any function available for the above?
>>>>
>>>> Kindly inform.
>>>>
>>>> Thank you,
>>>> Soma
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190222/45742e61/attachment.html>
```