Re: Turning off math error checking for a code block [message #28892 is a reply to message #28890] |
Thu, 17 January 2002 12:23   |
Paul van Delst
Messages: 364 Registered: March 1997
|
Senior Member |
|
|
Kenneth Bowman wrote:
>
> In article <3C47094C.1F1879D2@ssec.wisc.edu>, "Liam E. Gumley" <Liam.Gumley@ssec.wisc.edu> wrote:
>
>> The FINITE function returns 1 where the argument is finite, and 0 where
>> the argument is infinite *or* NaN (see p. 134 of my book). Try the
>> following:
>>
>> x_min = 2.0
>> index = where(finite(x) eq 1, count)
>> if (count gt 0) then print, where(x[index] lt x_min)
>
> I am aware of that. These are relatively large vectors (10^5 to 10^6 elements),
> however, and this operation is repeated many times, so I am trying to avoid
> extracting the finite values (or creating an array index to them). This is my
> "innermost loop", and efficiency is important. I know there are NaN's. I prefer
> to simply turn off the error messages.
Hmm. This is straying way off topic...and don't take it the wrong way or anything, but how come
you don't prefer to simply prevent the NaNs from occurring in the first place?
(To the NG) Does IDL stop processing compound logical tests before they're completed? What
about:
i = WHERE((FINITE(x) EQ 1) AND (x LT x_min), ni)
Will the second test for any particular index value still get performed if the first one fails?
I should look this up in me IDL book, I know......
paulv
>
> P.S. For symmetry, wouldn't it be nice to have an INFINITE function?
And don't forget the complementary NOT_A_NAN() function. :o)
--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
|
|
|