Re: Really BASIC idl programming question [message #37805] |
Sat, 24 January 2004 03:13 |
Chris Lee
Messages: 101 Registered: August 2003
|
Senior Member |
|
|
In article <7d715aa0.0401231820.4a34c719@posting.google.com>, "BG"
<u2s5thmember@yahoo.com> wrote:
> I pick all the data 1) where the "num" array is
> between 0 and 1, and "temp" is between 195-200.
> 2) where "numb" is between 0.1 and 1, and "temp" is between 195 and 200.
> 3) "num": 0.2 through 1 and "temp": 195 to 200 4) .... and so on...
<....snip...>
> I know I should be using multidimensional arrays, but I always get stuck
> trying to define "new_array" without using all these repeated where
> statements.
> Thanks for suffering through this! I would Dearly appreciate ANY
> suggestions (other than quit programming!) ;) thanks again!
Hi,
The easiest method I can come up with is almost the
same as yours, except the WHERE statements involving temperature are
rolled into a histogram function...e.g
;find the 'num' ranges first
a=where(num gt 0,count_a)
b=where(num gt 0.1,count_b)
c=where(num gt 0.2,count_c)
;use each 'num' range in a histogram
if(count_a gt 0) then ha=histogram(temp[a], binsize=5, min=195, max=205)
if(count_b gt 0) then hb=histogram(temp[b], binsize=5, min=195, max=205)
if(count_c gt 0) then hc=histogram(temp[c], binsize=5, min=195, max=205)
new_array=[ha,hb,hc]
;
;
The only matrix method I can think of wouldn't be any quicker and would
probably use more memory.
Chris.
|
|
|