A strange error with WHERE [message #67485] |
Thu, 30 July 2009 20:08  |
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  |
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  |
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.")
|
|
|
|