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

Home » Public Forums » archive » Search single column of array - removing nasty loop
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Search single column of array - removing nasty loop [message #78555] Tue, 29 November 2011 01:11
rjp23 is currently offline  rjp23
Messages: 97
Registered: June 2010
Member
I was hoping that there was a nice way to do the following. I have a
4D array and I want to check if the 4th dimension contains a 0 in any
of it's values for each value of the other 3 dimensions, if it does I
want that whole column set to 0.

This is how I'm doing it with a loop:

FOR i=0, 1 DO BEGIN
FOR k = 0, 359 DO BEGIN
FOR j = 0, 5 DO BEGIN
test = where(array[i,j,k,*] eq 0)
IF max(test) gt -1 THEN array[i,j,k,*] = 0
ENDFOR
ENDFOR
ENDFOR

which is obviously horrible and slow.

Any help/advice would be great.

Thanks

Rob
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: create an UTM grid
Next Topic: IDL QUESTIONS(time convection)

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

Current Time: Fri Oct 10 13:31:48 PDT 2025

Total time taken to generate the page: 0.88100 seconds