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

Home » Public Forums » archive » Using 1D FFT to decompose the provided hurricane data in terms of wavenumbers.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Using 1D FFT to decompose the provided hurricane data in terms of wavenumbers. [message #90487] Wed, 04 March 2015 15:10 Go to next message
twiel002 is currently offline  twiel002
Messages: 1
Registered: March 2015
Junior Member
I have 240x240 array of hurricane wind speed.

1) I need to covert to polar coordinates and plot the speed on a contour map with a radius of [-108,108], however what I have doesn't appear to be correct.

My Code:

Pro Projet2COORD

;;;---Reading in the data---;;;


rows = 240
cols = 240
spd = FltArr(240,240)
OpenR, lun, 'speed.csv', /Get_Lun
ReadF, lun, spd
Free_Lun, lun
print, spd

rows = 240
cols = 240
X = FltArr(240,240)
OpenR, lun, 'Xdir.csv', /Get_Lun
ReadF, lun, X
Free_Lun, lun
print, X

rows = 240
cols = 240
Y = FltArr(240,240)
OpenR, lun, 'Ydir.csv', /Get_Lun
ReadF, lun, Y
Free_Lun, lun
print, Y

;;;---Interpolate the coordinates---;;;

R=sqrt(X^2+Y^2)
Theta=atan(Y/X)*2*!PI
spd1=Polar_Surface(spd, R, Theta)

unsmooth = CONTOUR(spd1, TITLE='Hurricane Wind Speed', $
LAYOUT=[2,1,1], RGB_TABLE=13, /FILL, N_LEVELS=12)

; Draw the outline of the 12 levels
outline1 = CONTOUR(spd1, N_LEVELS=12, /OVERPLOT)



2) I need to then decompose the speed into wavenumbers using a 1D FFT, however I have no idea how to plot these wavenumbers on a similar plot to the polar plot from above.
I need wavenumbers 0-3, the sum of those wavenumbers, and wavenumbers 0-9.
Any assistance is appreciated.
Re: Using 1D FFT to decompose the provided hurricane data in terms of wavenumbers. [message #90494 is a reply to message #90487] Thu, 05 March 2015 07:32 Go to previous messageGo to next message
Burch is currently offline  Burch
Messages: 28
Registered: December 2013
Junior Member
On Wednesday, March 4, 2015 at 5:11:01 PM UTC-6, twie...@fiu.edu wrote:
> I have 240x240 array of hurricane wind speed.
>
> 1) I need to covert to polar coordinates and plot the speed on a contour map with a radius of [-108,108], however what I have doesn't appear to be correct.

> Theta=atan(Y/X)*2*!PI

Calculating theta in this way will give you incorrect results. For instance, notice that

IDL> y = 1.0/2.0
IDL> x = -1.0/2.0
IDL> print, atan(y/x)
-0.785398

and

IDL> y = -1.0/2.0
IDL> x = 1.0/2.0
IDL> print, atan(y/x)
-0.785398

give the same result even though the locations are in different quadrants! You should use the two argument form of atan()

Theta = atan(y, x)

This will give you results ranging from -pi to pi. To change to 0 to 2 pi do

Theta = (theta + 2.0*!pi) mod (2.0*!pi)

-Jeff
Re: Using 1D FFT to decompose the provided hurricane data in terms of wavenumbers. [message #90495 is a reply to message #90494] Thu, 05 March 2015 07:41 Go to previous message
Burch is currently offline  Burch
Messages: 28
Registered: December 2013
Junior Member
> Theta = atan(y, x)
>
> This will give you results ranging from -pi to pi. To change to 0 to 2 pi do
>
> Theta = (theta + 2.0*!pi) mod (2.0*!pi)

Or, obviously, just combine the two lines

theta = (atan(y,x) + 2.0*!pi) mod (2.0*!pi)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: FG Bug -- Legend/Cleanup
Next Topic: FG Save method -- Gifs

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

Current Time: Wed Oct 08 09:19:57 PDT 2025

Total time taken to generate the page: 0.00447 seconds