comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » wavenum, frequency FFT plot
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: wavenum, frequency FFT plot [message #66221 is a reply to message #66173] Wed, 29 April 2009 10:49 Go to previous messageGo to previous message
kishore1818 is currently offline  kishore1818
Messages: 24
Registered: June 2007
Junior Member
On Apr 29, 9:38 am, "R.G. Stockwell" <noemai...@please.com> wrote:
> <kishore1...@gmail.com> wrote in message
>
> news:6157cb9b-a549-4b42-8845-798916fbda9b@c18g2000prh.google groups.com...
> On Apr 23, 3:03 pm, "R.G. Stockwell" <noemai...@please.com> wrote:
> Hi Bob,
> Thanks for your e-mail message.
> Actually I have 365 days daily avg values, every 10 deg latitudinal
> averages.
> ie., (365,18). I need to calculate the psd for 30days data sets for
> all latitudinal values.
> But I am planning to plot contour: wvae no. (x axis), frequency (y-
> axis) and z is power.
> could you give a example program then it is very easy to understand to
> me and also I am beginner in IDL.
>
> Thanking you,
> Kishore
>
> Here you go:
>
> ndays = 365
> nlats = 18
>
>  ; make fake data with DC component
>  data = randomn(seed,ndays,nlats) + 0.2
>
> spe =fft(data)  ; 2D fft
>
> ; make the frequency and wavenumber arrays
> freqs = findgen(ndays)/ndays
> ; put in negative freqs
> freqs[ndays/2+1:*] = -1.0 + freqs[ndays/2+1:*]
>
> wavenumbers = findgen(nlats)
> ; put in negative wavenumbers
> wavenumbers[nlats/2+1:*] = -nlats + wavenumbers[nlats/2+1:*]
>
> ;FFT has postive freqs first
> ; (0, 1/NT, 2/NT up to nyquist, then most negative
> ; and then counting towards zero)
>
> ;if you want, you can switch it to the "normal way"
> ; of viewing the spectr, with 0,0 at the middle.
> ; so shift the spectra.
> spe = shift(spe,ndays/2, nlats/2-1) ; note ndays is odd, nlats is even
> ;shift the freqs
> freqs = shift(freqs,ndays/2)
> ;shift the wavenumbers
> wavenumbers = shift(wavenumbers,nlats/2-1)
>
> ; ALSO you want the wavenumber on the x axis, so transpose
> spe = transpose(spe)
>
> ; make levels for contour plot
> nlevels = 40
> levels =
> findgen(nlevels+2)/nlevels*(max(abs(spe))-min(abs(spe)))+min (abs(spe),/nan)
> contour,abs(spe),wavenumbers,freqs,levels=levels,/fill,$
>  xtitle='Meridional Wavenumber',ytitle='Frequency (1/day)'
>
> end

Thanks for providing the detailed code.

Kishore
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Building a mask from a vector file programmatically in ENVI‏‏
Next Topic: 2D analogue of the WHERE function?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 10:33:34 PDT 2025

Total time taken to generate the page: 2.15472 seconds