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

Home » Public Forums » archive » Need Help Resolving ENDIF Errors
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
Need Help Resolving ENDIF Errors [message #65538] Tue, 10 March 2009 13:38 Go to next message
einszweilieb is currently offline  einszweilieb
Messages: 4
Registered: March 2009
Junior Member
I'm trying to run a procedure in IDL. The procedure has a series of
IF LOOPS, each of minimal complexity - they are fairly simple.

For example:

XX=readfits('/home/kphil/img/img213.fits')
YY=readfits('/home/kphil/img/img213.fits', EXTEN_NO=1)
ZZ =YY

G = where(ZZ ne 0)
invarmap= ZZ * 0.0
invarmap[G] = (1./(ZZ[G])^2)

if ((where(XX ne XX))(0) ne -1) then begin
ZZ[where(XX ne XX)] = 0
XX[where(XX ne XX)] = 0
endif


The problem is that everything runs just great, until the ENDIF is
reached. I CONSTANTLY get ENDIF errors.

Why is this happening? I feel that my code is solid, but all I get
are ENDIF errors.

The .pro I'm running has about 7 IF LOOPS, and the ONLY errors I get
are on the lines where ENDIF is.

Any idea what the problem is? Help!

Thanks in advance.
Re: Need Help Resolving ENDIF Errors [message #65581 is a reply to message #65538] Thu, 12 March 2009 07:43 Go to previous message
Carsten Lechte is currently offline  Carsten Lechte
Messages: 124
Registered: August 2006
Senior Member
Carsten Lechte wrote:
> David Fanning wrote:
>> it. Better to use something that is actually defined
>> in the operating system, I think.
>
> Or, more precisely, the language environment. The C library for
> GNU cc correctly implements the 'NaN ne NaN' behaviour on all
> operating systems (at least according to the manual). IDL
> inherits its environment from the compiler that is used.

And I forgot to add:
That is why David and I suggest one should prefer documented features
of a system (like FINITE()). On the other hand, who would have
thought to test for basic IEEE 754 compliance before using an
IEEE 754 feature?


chl
Re: Need Help Resolving ENDIF Errors [message #65582 is a reply to message #65538] Thu, 12 March 2009 07:35 Go to previous message
Carsten Lechte is currently offline  Carsten Lechte
Messages: 124
Registered: August 2006
Senior Member
David Fanning wrote:
> it. Better to use something that is actually defined
> in the operating system, I think.

Or, more precisely, the language environment. The C library for
GNU cc correctly implements the 'NaN ne NaN' behaviour on all
operating systems (at least according to the manual). IDL
inherits its environment from the compiler that is used.


chl
Re: Need Help Resolving ENDIF Errors [message #65583 is a reply to message #65538] Thu, 12 March 2009 07:28 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jeremy Bailin writes:

> Ye gods! I must admit to never having used IDL in windows, so I've
> never found that issue. Or used windows at all in a decade, for that
> matter. Hmmm.

As Warren Buffet said the other day, it's not who
YOU are sleeping with, it's who THEY are sleeping with.
Hard to say where those programs we write will show up
next. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Need Help Resolving ENDIF Errors [message #65585 is a reply to message #65538] Thu, 12 March 2009 07:14 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Mar 11, 9:11 pm, David Fanning <n...@dfanning.com> wrote:
> Jeremy Bailin writes:
>> 1. Yes, there is a use of asking where(XX ne XX) - it tells you where
>> there are NaNs. I use it all the time.
>
> Oh, dear! That's sorta like using the rhythm method of
> birth control, isn't it? I mean, maybe combined with
> hope and prayer, but...I certainly wouldn't rely on
> it. Better to use something that is actually defined
> in the operating system, I think. Here is an article:
>
>   http://www.dfanning.com/math_tips/nans.html
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Ye gods! I must admit to never having used IDL in windows, so I've
never found that issue. Or used windows at all in a decade, for that
matter. Hmmm.

Any idea whether this statement: "If this turns out to be true there a
good chance that in the future the behavior of the Windows and Unix
versions of IDL will be consistent. [That is, versions after IDL
5.6.]" is indeed true for recent versions?

-Jeremy.
Re: Need Help Resolving ENDIF Errors [message #65599 is a reply to message #65538] Wed, 11 March 2009 18:11 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jeremy Bailin writes:

> 1. Yes, there is a use of asking where(XX ne XX) - it tells you where
> there are NaNs. I use it all the time.

Oh, dear! That's sorta like using the rhythm method of
birth control, isn't it? I mean, maybe combined with
hope and prayer, but...I certainly wouldn't rely on
it. Better to use something that is actually defined
in the operating system, I think. Here is an article:

http://www.dfanning.com/math_tips/nans.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: how to calculate distance from pairs of latitude/longitude measurements?
Next Topic: view/model questions

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

Current Time: Fri Oct 10 06:09:31 PDT 2025

Total time taken to generate the page: 1.12098 seconds