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

Home » Public Forums » archive » Re: Resampling data with irregular time base
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: Resampling data with irregular time base [message #15690 is a reply to message #15680] Sat, 05 June 1999 00:00 Go to previous messageGo to previous message
Richard G. French is currently offline  Richard G. French
Messages: 65
Registered: June 1997
Member
Karl Krieger wrote:
>
> I have data with an irregular time base, which I would like to resample
> in a regular spaced time base. How can I average over all original data
> points in each interval of the new time vector without resorting to a
> FOR loop?
> Currently I am using this horrible kludge:
>
> deltat = newtime[1] - newtime[0]
> FOR n=0, n_elements(newtime)-1 DO BEGIN
> index = where((oldtime GT (newtime[n]-deltat/2.)) AND $
> (oldtime LE (newtime[n]+deltat/2.)), $
> count)
> IF count GT 0 THEN newdata[n] = total(olddata[index]) / count
> ENDFOR
>

Another idea! Make sure that oldtime is a sorted array.
Then do a simple interpolation into the oldtime array to find the bin
location boundaries that correspond to the newtime locations. This gives
you the indices in the oldtime[] array that correspond to the points you
are after for each newtime[]
data point. You still have to do a loop, but you are saving a LOT of
time by not having to use WHERE over the full range of oldtime[] - you
already know the approximate range of data in oldtime[] that fall
withing the newtime[] bin, and you can interrogate this MUCH smaller set
of points inside your loop to see if there are actually any data points
within the deltat range of each newdata[] point.
Dick French
rfrench@mediaone.net
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: CW_FSLIDER woes
Next Topic: Re: pv-wave?

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

Current Time: Fri Oct 10 15:18:05 PDT 2025

Total time taken to generate the page: 0.64321 seconds