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

Home » Public Forums » archive » Re: overriding system functions.
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: overriding system functions. [message #43828] Thu, 28 April 2005 18:59 Go to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <1114696363.867468.129920@z14g2000cwz.googlegroups.com>,
jlamm2223443@yahoo.com wrote:

> I teach IDL for a small class here and me and my students have trouble
> with functions such as max and min. Like max expects an arry
> but if I say max(1,2) it runs and on some lists it runs with the
> wrong results. Fair enough I called it wrong but what I would love
> it to have my own preloaded max function that checks if the input
> is indeed an array and then if it is call the max function or otherwise
> post an error message and bomb. Also, we use -9999 for missing data
> but sin(-9999) turn it into a reasonable value. I would love my own
> sin that first check if in the range -20 to 20 radians is the input
> since if not then probably an error. Any suggestions how I do that?
>
> jlamm2223443@yahoo.com
>

If your variables are floating point (not integers), I recommend using
NaNs for missing data flags.

i = WHERE(x EQ -9999, count)
IF (count GT 0) THEN x[i] = !VALUES.F_NAN

This removes the possibility of inadvertently using missing data as
valid, and many functions have a NAN keyword (see the manual).

Ken Bowman
[Message index]
 
Read Message
Read Message
Previous Topic: idlwave in XEmacs
Next Topic: Re: Plot Clipping Problems

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

Current Time: Wed Oct 08 13:44:10 PDT 2025

Total time taken to generate the page: 0.00540 seconds