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

Home » Public Forums » archive » Re: how to loop through data?
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: how to loop through data? [message #74849 is a reply to message #74840] Wed, 02 February 2011 14:42 Go to previous message
Ammar Yusuf is currently offline  Ammar Yusuf
Messages: 36
Registered: October 2010
Member
On Feb 2, 5:29 pm, smuzz <smussol...@gmail.com> wrote:
> Hi --
>
> I am new to programming in IDL and I want to execute a for loop. The
> data I have contains number of whale calls from different species over
> a 2 month period. I have manually gone through and specified the start
> and end of periods of calling that I want to focus on (i.e. bouts).
> Now I want to look 1 hour before the start of each bout and 1 after
> the end of each bout to total up all the whale calls that I hear from
> the different species. I have about 20 bouts and ideally would like to
> write some sort of for loop that will go through each bout and tally
> up calls, but I am a bit confused how I would go about this since my
> bouts are all different and appreciate any suggestions...
>
> ***********************
> What I have so far:
>
> ; This finds all the calls for the 1st species
> l = where(auto(*).species eq 7 and auto(*).call_type eq 1 and
> auto(*).start_time gt stime and auto(*).start_time lt etime,lcount)
>
> ; This finds all the calls for the 2nd species
> m = where(auto(*).species eq 7 and auto(*).call_type eq 3 and
> auto(*).start_time gt stime and auto(*).start_time lt etime,mcount)
>
> ; This finds all the calls for the 3rd species
> n = where(auto(*).species eq 10 and auto(*).call_type eq 0 and
> auto(*).start_time gt stime and auto(*).end_time lt etime,ncount)
>
> ; These are the start and end times of a few of my bouts (I've already
> taken care of converting time)
> start_bout1 = '11/19/09 22:30:00'
> end_bout1 = '11/19/09 23:21:00'
> start_bout2 = '11/20/09 02:06:00'
> end_bout2= '11/20/09 02:56:00'
> start_bout3= '11/20/09 19:27:00'
> end_bout3= '11/20/09 20:07:00'
> start_bout4= '11/20/09 21:37:00'
> end_bout4= '11/20/09 22:49:00'
> start_bout......
>
> *********************
>
> Thanks, S

Hi, I'm not sure what exactly you're looking for but I'll give it a
shot.

for i = 0, n_elements(l) do begin
print, l[i]
print, auto[l[i]]
; do some stuff with auto[l[i]] because I'm assuming that's the
index that you wanted.
; do some more stuff
endfor

Not sure if this is what you were looking for.
[Message index]
 
Read Message
Read Message
Previous Topic: New Coyote Book Delayed
Next Topic: Writing an efficient array operation in IDL

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

Current Time: Fri Oct 10 03:46:41 PDT 2025

Total time taken to generate the page: 0.40591 seconds