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

Home » Public Forums » archive » averaging w.r.t time resolution
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: averaging w.r.t time resolution [message #87240 is a reply to message #87239] Mon, 20 January 2014 06:53 Go to previous messageGo to previous message
Matthew is currently offline  Matthew
Messages: 18
Registered: February 2006
Junior Member
> I have a data array for 86400 seconds each day (i.e., @ 1 second resolution). Is there any direct function in IDL which can be used to get the different time resolution (i.e., say 1 minute or 5 minute or 15 minute or 1 hour etc.) averages of the data array with respective time stamp automatically?

I can think of three options:

1. Rebin + Interpol

IDL> data = randomu(1, 86400)
IDL> time = findgen(86400)
IDL> new_time = rebin(time, 17280) ;Every ~5 minutes
IDL> new_data = interpol(data, time, new_time)
http://exelisvis.com/docs/REBIN.html
http://exelisvis.com/docs/INTERPOL.html

2. Congrid + Interpol

IDL> data = randomu(1, 86400)
IDL> time = findgen(86400)
IDL> new_time, congrid(time, 12342) ;Every ~7 minutes
IDL> new_data = interpol(data, time, new_time)
http://exelisvis.com/docs/CONGRID.html

Note that rebin and congrid do different things. Rebin averages while Congrid resamples.


3. Interpol + a little work

Might be helpful:
linspace https://klassenresearch.orbs.com/Emulate+linspace+and+logspa ce
or
In IDL 8.3 use findgen or the colon operator
http://www.exelisvis.com/docs/Other_Operators.html
http://www.exelisvis.com/docs/FINDGEN.html

IDL> data = randomu(1, 86400)
IDL> old_time = findgen(86400)
IDL> nMinute = 7 ;Minute intervals
IDL> nTimes = 86400/nMinute ;Number of time stamps
IDL> new_time = findgen(nTimes)/(nTimes-1) * 86400
IDL> new_data = interpol(data, old_time, new_time)
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Plotting with colorbar
Next Topic: Subset of a structure?

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

Current Time: Fri Oct 10 07:18:56 PDT 2025

Total time taken to generate the page: 1.43379 seconds