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

Home » Public Forums » archive » A strange error with WHERE
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
A strange error with WHERE [message #67485] Thu, 30 July 2009 20:08 Go to next message
Lindzen is currently offline  Lindzen
Messages: 4
Registered: July 2009
Junior Member
Dear all,
I come across a strange error with WHERE function. Could you
please help me to check it?
Here is part of the code. I will explain below the code.

outer1_begin: id_hr = where(r03_temp ge 50)
n_hr = n_elements(id_hr)

if (n_elements(id_hr) gt 1) then begin
id_max = where(r03_temp eq max(r03_temp))
lonc = lon_aoc(id_max)
latc = lat_aoc(id_max)

ii=0
outer2_begin: print,ii
ii=ii+1
lon_left = lonc-ii*0.5
lon_right = lonc+ii*0.5
lat_up = latc+ii*0.5
lat_down = latc-ii*0.5
id_box = where(lon_aoc ge lon_left)

Here lon_left=117.25, is a flot number. lon_aoc is a 80*30 matrix,
with many values larger than 117.25.
If I use id=where(lon_aoc ge 117.25), id returns right results.
However, the above code returns -1 to id_box. It is really strange.
Could anyone help me? Thank you very much!

Lin
Re: A strange error with WHERE [message #67548 is a reply to message #67485] Fri, 31 July 2009 13:44 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
David Fanning wrote:
> Paul van Delst writes:
>
>> I enjoy watching you grok people's problems from afar. It's quite instructive when
>> contemplating debugging in general.
>
> Speaking of which. I have a new book on my desk.
>
> Debugging: The 9 Indispensable Rules for Finding
> Even the Most Elusive Software and Hardware Problems
> by David J. Agans

Here's two more for general consumption:

http://www.pragprog.com/titles/ahptl/pragmatic-thinking-and- learning
http://www.pragprog.com/titles/pbdp/debug-it

The first one was a good ego-deflater (which is good for debugging) .... just what one
needs to overcome a creeping superiority complex where one believes they know what they're
doing! Just when you think you're becoming an expert, you realise you're still an advanced
beginner[*]. Sigh. Oh well.

The second one I'm still saving up for.

> I haven't finished reading it yet, so I haven't reviewed
> it. But you could probably read it in one or two sittings
> and probably gleen something useful from it.
>
> A lot of it is what I think of as common sense, but I'm
> always surprised to see how uncommon it is when I work
> with other programmers. ;-)

I hear ya. But, we (IDL programmers I mean) are at an advantage with respect to folks
using other languages because we *have* to think illogically to make *any* sense of it
all.... :o)

cheers,

paulv


[*] A former boss of a boss of mine once defined four stages of professional development:
1) Unconscious incompetence.
2) Conscious incompetence.
3) Conscious competence.
4) Unconscious competence.
Needless to say it caused a bit of uproar at the time since some people took offense at
being labeled incompetent. The pragmatic-thinking-and-learning book above has a more
politically correct list:
1) Beginner
2) Advanced beginner
3) Proficient
4) Expert
where Expert == the sort of folks that get invited to speak at conferences in exotic
locales, all expenses paid.

But I still prefer the first list. :o)
Re: A strange error with WHERE [message #67550 is a reply to message #67485] Fri, 31 July 2009 13:19 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paul van Delst writes:

> I enjoy watching you grok people's problems from afar. It's quite instructive when
> contemplating debugging in general.

Speaking of which. I have a new book on my desk.

Debugging: The 9 Indispensable Rules for Finding
Even the Most Elusive Software and Hardware Problems
by David J. Agans

I haven't finished reading it yet, so I haven't reviewed
it. But you could probably read it in one or two sittings
and probably gleen something useful from it.

A lot of it is what I think of as common sense, but I'm
always surprised to see how uncommon it is when I work
with other programmers. ;-)

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: A strange error with WHERE [message #67551 is a reply to message #67485] Fri, 31 July 2009 13:13 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paul van Delst writes:

> I enjoy watching you grok people's problems from afar. It's quite instructive when
> contemplating debugging in general.

Yeah, getting color to work is so yesterday. My big
mission now is to get people to actually think a little. :-)

Cheers,

David

P.S. There are a couple of articles about this Where gotcha
on my web page:

http://www.dfanning.com/misc_tips/brokenwhere.html
http://www.dfanning.com/misc_tips/noidea.html



--
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: True-Color Modis Image
Next Topic: How not to plot blank/zero points?

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

Current Time: Fri Oct 10 15:07:00 PDT 2025

Total time taken to generate the page: 0.72104 seconds