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

Home » Public Forums » archive » Re: rebinning data on new time samples without loops?
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: rebinning data on new time samples without loops? [message #37285 is a reply to message #37270] Fri, 12 December 2003 06:31 Go to previous messageGo to previous message
K. Bowman is currently offline  K. Bowman
Messages: 330
Registered: May 2000
Senior Member
In article <d916d48a.0312111543.8425684@posting.google.com>,
jbattat@cfa.harvard.edu (James) wrote:

> Hi there,
>
> I have a time series of data, y, sampled on an irregular grid, t1.
> I would like to rebin y onto an existing time series (also irregular),
> t2.
>
> for loop over t1
> dT = t2 - replicate(t1[i],nt2)
> ID = where(dT EQ min(dT))
> dump y1[i] data into y2[ID] if min(dT) < dTMax
> increment counter[ID]
> endfor loop
>
> then divide y2/counter to get the rebinned value.


Since your data is already sorted by time, you can use a binary search
(VALUE_LOCATE). It is *much* faster than WHERE on long vectors.

Loop over t2 (not t1), find the points in t1 closest to t2-dt and t2+dt
using VALUE_LOCATE. Then average as you are doing.

Ken bowman
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Permanently changing shell
Next Topic: Re: Subscripting multidimensional arrays

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

Current Time: Sun Nov 30 15:13:29 PST 2025

Total time taken to generate the page: 0.21669 seconds