<div dir="auto">Best idea will be use nlat*nlon as total grid points using reshape and reorder the data so that input to the fft2df will be 2 dimensional (ngrids, ntim).<div dir="auto"><br></div><div dir="auto">Coef will then give you output as 2 x ngrids x (ntim/2+1).</div><div dir="auto"><br></div><div dir="auto">Soma</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Feb 22, 2019, 21:32 Soma Roy <<a href="mailto:somaroy892@gmail.com">somaroy892@gmail.com</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Glad to know.<div dir="auto">Many thanks Dennis.<br><div dir="auto"><br></div><div dir="auto">Soma</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Feb 22, 2019, 21:09 Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank" rel="noreferrer">shea@ucar.edu</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span style="color:rgb(0,0,255)"><b>Please do not send direct emails to people. Only to ncl-talk.</b></span></div><div><br></div><div>If "X" is the data then how can we use it?<div dir="auto"><br></div><div dir="auto">X (ntime, nlat, nlon).</div><div dir="auto"><br></div><div dir="auto">Output result matrix should be same as X.</div><div dir="auto">==============<br></div></div><div><br></div><div><b>As noted in the documentation, </b>the function is prototyped as 2-dimensional</div><div><br></div><div><pre><b>function fft2df ( x [*][*])</b></pre></div><div>As I said, you must use a do loop. It is user (your) responsibility to do any book keepind [savinh]<br></div><div><pre> <span style="font-family:arial,helvetica,sans-serif">ntim = 8
nlat = 6
mlon = 8<br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/random_normal.shtml" rel="noreferrer noreferrer" target="_blank"><b> </b>x = <b>random_normal</b></a>( 10, 5, (/ntim,nlat,mlon/) )
xNew = new( <b>dimsizes</b>(x), "float")
<br> do nt=0,ntim-1 <br> ; ANALYSIS<br> coef = <b>fft2df</b> (x(nt,:,:_) ; <b>coef: [2] x [6] x [5] ; [2] x [nlat] x [mlon/2+1]</b>
; do something with coef <b><== *YOUR* responsibility</b>
xNew(nt,:,:) = <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/fft2db.shtml" rel="noreferrer noreferrer" target="_blank"><b>fft2db</b></a> (coef) ; SYNTHESIS<br></span></pre><pre><span style="font-family:arial,helvetica,sans-serif"> end do<br><br>Please do not use this if you do not know how to use 2D FFT output.<br>ncl-talk can not become your programmer.<br><br> Again, as noted in the function documentation, a readable introduction to 2D-FFT is at:<br> <a href="http://www.dspguide.com/pdfbook.htm" rel="noreferrer noreferrer" target="_blank"><b>http://www.dspguide.com/pdfbook.htm</b></a>
</span><br>===
<span style="font-family:arial,helvetica,sans-serif">As noted in the documentation, NCL uses<b> <a href="https://www2.cisl.ucar.edu/resources/legacy/fft5" rel="noreferrer noreferrer" target="_blank"> FFTPACK5</a> </b>developed by Paul Swarztrauber and Richard Valent. <b><br></b>The specific Fortran subroutines used are:</span><b><br> fft2df:
<a href="http://www2.cisl.ucar.edu/resources/legacy/fft5/documentation#rfft2f.html" rel="noreferrer noreferrer" target="_blank">http://www2.cisl.ucar.edu/resources/legacy/fft5/documentation#rfft2f.html</a>
fft2db:
<a href="http://www2.cisl.ucar.edu/resources/legacy/fft5/documentation#rfft2b.html" rel="noreferrer noreferrer" target="_blank">http://www2.cisl.ucar.edu/resources/legacy/fft5/documentation#rfft2b.html</a>
</b></pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 22, 2019 at 8:06 AM Soma Roy <<a href="mailto:somaroy892@gmail.com" rel="noreferrer noreferrer" target="_blank">somaroy892@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">If "X" is the data then how can we use it?<div dir="auto"><br></div><div dir="auto">X (ntime, nlat, nlon).</div><div dir="auto"><br></div><div dir="auto">Output result matrix should be same as X.</div><div dir="auto"><br></div><div dir="auto">Soma</div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Feb 22, 2019, 20:24 Dennis Shea <<a href="mailto:shea@ucar.edu" rel="noreferrer noreferrer" target="_blank">shea@ucar.edu</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Please look at NCL's function documentation</div><div><br></div><div><b><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/fft2df.shtml" rel="noreferrer noreferrer noreferrer" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/fft2df.shtml</a><a href="http://goog_952811495" rel="noreferrer noreferrer noreferrer" target="_blank"><br></a></b></div><div><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/fft2db.shtml" rel="noreferrer noreferrer noreferrer" target="_blank"><b>http://www.ncl.ucar.edu/Document/Functions/Built-in/fft2db.shtml</b></a></div><div><br></div><div>You will have to loop over each time step. <br></div><div><br></div><div><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 22, 2019 at 12:09 AM Soma Roy <<a href="mailto:somaroy892@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">somaroy892@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Hello,<div dir="auto">I have a time series data (ntime, nlat, nlon) in spatial domain. I want to calculate fourier decomposition of the same over lat lon.</div><div dir="auto">How to do it using ncl? Is there any function available for the above?</div><div dir="auto"><br></div><div dir="auto">Kindly inform.</div><div dir="auto"><br></div><div dir="auto">Thank you,</div><div dir="auto">Soma</div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" rel="noreferrer noreferrer noreferrer" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>