Absolutely. take for example something like this:
An example structure:
IDL> x = replicate({temperature:0.0, pressure:0.0}, 10)
IDL> x.pressure = findgen(10)*100
IDL> help, x
X STRUCT = -> Array[10]
IDL> print, x
{ 0.000000 0.000000}{ 0.000000 100.000}{ 0.000000 200.000}{ 0.000000
300.000}{ 0.000000 400.000}{ 0.000000 500.000}{ 0.000000 600.000}{
0.000000 700.000}{ 0.000000 800.000}{ 0.000000 900.000}
Now look for the values you want and make a new structure array with only those values:
IDL> w = where( (x.pressure ge 100) and (x.pressure le 500) )
IDL> newx = x[w]
IDL> help, newx
NEWX STRUCT = -> Array[5]
IDL> print, newx
{ 0.000000 100.000}{ 0.000000 200.000}{ 0.000000 300.000}{ 0.000000
400.000}{ 0.000000 500.000}
This will allow you to do what you want without the use of FOR loops, which will greatly speed up your code. The where statement can have as many conditional statements as you want inside, using standard bitwise operators such as AND, OR, XOR, NOT, etc.
-Josh
ITT-VIS Tech Support
|