Re: IDL QUESTIONS(time convection) [message #78539] |
Tue, 29 November 2011 09:49 |
zolile mtumela
Messages: 50 Registered: September 2011
|
Member |
|
|
On Nov 29, 7:44 pm, David Fanning <n...@dfanning.com> wrote:
> zolile mtumela writes:
>> The aims of these plots are find the spetral peaks. Now I can't read
>> the spectrum. It is important for me do sampling rate of 120 seconds.
>> Lack of understanding is killing me.
>> I need help and suggestions about solving this problem.
>
> Well, I don't know. This code seems to do what you want
> to do, with the data you provided this morning.
>
> !p.multi=[0,1,2]
> Result = interpol(vel,time,U)
> cgplot, (time-time[0])/3600., vel, $
> linestyle = 2, xtitle='Hours'
> cgplot, (u-u[0])/3600., result, /overplot, $
> psym=2, color='red'
> N = n_elements(result)
> print, N
> T = 120
> Spec = fft(result)
> freq_axis =findgen(N)/(N*T)
> cgplot, freq_axis[0:N/2],abs(spec[0:N/2]), $
> xrange =[0.001,0.005], xstyle=1
> !p.multi=0
> end
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Thank you so David
|
|
|
Re: IDL QUESTIONS(time convection) [message #78540 is a reply to message #78539] |
Tue, 29 November 2011 09:44  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
zolile mtumela writes:
> The aims of these plots are find the spetral peaks. Now I can't read
> the spectrum. It is important for me do sampling rate of 120 seconds.
> Lack of understanding is killing me.
> I need help and suggestions about solving this problem.
Well, I don't know. This code seems to do what you want
to do, with the data you provided this morning.
!p.multi=[0,1,2]
Result = interpol(vel,time,U)
cgplot, (time-time[0])/3600., vel, $
linestyle = 2, xtitle='Hours'
cgplot, (u-u[0])/3600., result, /overplot, $
psym=2, color='red'
N = n_elements(result)
print, N
T = 120
Spec = fft(result)
freq_axis =findgen(N)/(N*T)
cgplot, freq_axis[0:N/2],abs(spec[0:N/2]), $
xrange =[0.001,0.005], xstyle=1
!p.multi=0
end
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: IDL QUESTIONS(time convection) [message #78541 is a reply to message #78540] |
Tue, 29 November 2011 09:31  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
zolile mtumela writes:
> Lack of understanding is killing me.
Yes, those of us who practice science find this to be
the bane of our existence. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: IDL QUESTIONS(time convection) [message #78542 is a reply to message #78541] |
Tue, 29 November 2011 08:35  |
zolile mtumela
Messages: 50 Registered: September 2011
|
Member |
|
|
On Nov 29, 3:56 pm, David Fanning <n...@dfanning.com> wrote:
> zolile mtumela writes:
>> I tried to convert time axis to hours in the ff program, but all my
>> efforts are not working. I need some help and suggestion on this
>> convection.I have tried may ways but they are not converting in a
>> right way.
>
> Well, there are a couple of ways to do this. You could
> use the function LABEL_DATE to set up the time axis the
> way you wanted to display the time. For example:
>
> void = Label_Date(Date_Format='%D %M, %Y')
> plot, time, vel, linestyle = 2, xtickformat='label_date'
>
> Or, you can just use the calendar date formating codes
> directly with the XTickFormat keyword:
>
> plot, time, vel, linestyle = 2, xtickformat='(C(CDI,x,CMoA,x,CYI2))'
>
> These formats obviously aren't correct with this data,
> but I can't tell how the data should be formatted without
> more information about what these Julian numbers mean.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Hello David.
The times is 2 hours but given in seconds starting 24782520 ending
24789706 roughly around 7200 seconds.
but the sampling rate is 120 seconds which gives 60 elements.
I want to use 120 sec and as spacing of this data so that I can have
60 number of elements instead of this number 7081.
I think even in x I have to change the way of putting that statement.
the actualy program that we wrote is the ff.
;select the data file
File = Dialog_pickfile(Filter = '*.txt')
;read the data
rows = File_lines(file)
data = dblarr(2,rows)
openr,Lun,file,/Get_lun
ReadF,lun, data
data[0,*] = data[0,*]-min(data[0,*]); elapsed time
b = floor(min(data[0,*])); start time
e = ceil(max(data[0,*])); end time
x = Findgen(e-b+1); time
interp_vel = interpol(data[1,*], data[0,*],x); interpolating data
T=120.0
;draw the plots
plot,data[0,*]/3600.,data[1,*],linestyle=2
N=n_elements(interp_vel)
;han = hanning(N, /double)
spec = fft(interp_vel)
freq_axis = findgen(N)/(N*T)
spec=fft(interp_vel)
;N=n_elements(interp_vel)
freq_axis=findgen(N)/(N*T)
plot,freq_axis[0:N/2],abs(spec[0:N/2]),xrange=[0.001,0.005]
end
I can put the above data as it is, in the given format:
24782555 0.200000
24782675 -12.0000
24782795 -6.70000
24782915 2.40000
24783035 -11.4000
24783155 3.40000
24783275 1.30000
24783395 -2.80000
24783515 -8.60000
24783635 1.30000
24783755 -0.600000
24783875 -2.70000
24783995 -7.40000
24784115 -8.40000
24784235 0.100000
24784355 53.5000
24784475 23.9000
24784595 -5.60000
24784715 -2.10000
24784835 -10.2000
24784955 -8.20000
24785075 2.30000
24785195 -15.3000
24785315 5.70000
24785435 0.00000
24785555 -9.80000
24785675 54.3000
24785795 -8.60000
24785915 0.00000
24786035 29.6000
24786155 -32.5000
24786275 8.50000
24786515 60.1000
24786635 0.00000
24786755 59.8000
24786875 58.0000
24786995 52.4000
24787115 0.00000
24787235 0.00000
24787355 0.00000
24787475 0.00000
24787595 43.4000
24787715 55.4000
24787835 7.10000
24787955 -2.90000
24788075 22.0000
24788195 13.1000
24788315 -2.60000
24788435 31.5000
24788555 57.2000
24788675 41.8000
24788795 27.8000
24788915 31.4000
24789035 0.400000
24789155 24.6000
24789275 16.3000
24789395 -3.10000
24789515 4.00000
24789635 4.20000
By the above first program I thought it will be simple when using
interpol, but I guess i was wrong.
The aims of these plots are find the spetral peaks. Now I can't read
the spectrum. It is important for me do sampling rate of 120 seconds.
Lack of understanding is killing me.
I need help and suggestions about solving this problem.
Thank you for ur help
Zolile
|
|
|
Re: IDL QUESTIONS(time convection) [message #78543 is a reply to message #78542] |
Tue, 29 November 2011 08:34  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
zolile mtumela writes:
> the time is 2 hour but given in second
Well, then, why don't you just do this:
plot, (time-time[0])/3600., vel, linestyle = 2, xtitle='Hours'
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: IDL QUESTIONS(time convection) [message #78544 is a reply to message #78543] |
Tue, 29 November 2011 08:16  |
zolile mtumela
Messages: 50 Registered: September 2011
|
Member |
|
|
On Nov 29, 3:56 pm, David Fanning <n...@dfanning.com> wrote:
> zolile mtumela writes:
>> I tried to convert time axis to hours in the ff program, but all my
>> efforts are not working. I need some help and suggestion on this
>> convection.I have tried may ways but they are not converting in a
>> right way.
>
> Well, there are a couple of ways to do this. You could
> use the function LABEL_DATE to set up the time axis the
> way you wanted to display the time. For example:
>
> void = Label_Date(Date_Format='%D %M, %Y')
> plot, time, vel, linestyle = 2, xtickformat='label_date'
>
> Or, you can just use the calendar date formating codes
> directly with the XTickFormat keyword:
>
> plot, time, vel, linestyle = 2, xtickformat='(C(CDI,x,CMoA,x,CYI2))'
>
> These formats obviously aren't correct with this data,
> but I can't tell how the data should be formatted without
> more information about what these Julian numbers mean.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Hello David
the time is 2 hour but given in second
|
|
|
Re: IDL QUESTIONS(time convection) [message #78546 is a reply to message #78544] |
Tue, 29 November 2011 05:56  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
zolile mtumela writes:
> I tried to convert time axis to hours in the ff program, but all my
> efforts are not working. I need some help and suggestion on this
> convection.I have tried may ways but they are not converting in a
> right way.
Well, there are a couple of ways to do this. You could
use the function LABEL_DATE to set up the time axis the
way you wanted to display the time. For example:
void = Label_Date(Date_Format='%D %M, %Y')
plot, time, vel, linestyle = 2, xtickformat='label_date'
Or, you can just use the calendar date formating codes
directly with the XTickFormat keyword:
plot, time, vel, linestyle = 2, xtickformat='(C(CDI,x,CMoA,x,CYI2))'
These formats obviously aren't correct with this data,
but I can't tell how the data should be formatted without
more information about what these Julian numbers mean.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|