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

Home » Public Forums » archive » Re: How to solve this problem?
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
Re: How to solve this problem? [message #34719] Tue, 15 April 2003 10:28
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Big Bird (condor@biosys.net) writes:

> Some people (like me) only scan newsgroups occasionally, when we have
> a minute

Get out!! How can you do that!?

If I don't read the newsgroup every 10 minutes my hands
start shaking and I get an itch right between my shoulder
blades. My eyes start to burn at about 15 minutes.
I've considered drugs, but with my addictive personality
I don't think it would be a good idea.

Cheers,

David

P.S. Let's just say you guys who work in an office
probably have plenty of pretty co-workers to interact
with. I'm just stuck here with myself, still in my
pajamas, scratching myself and staring at a computer screen ...

I've really got to get a life. :-(

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: How to solve this problem? [message #34720 is a reply to message #34719] Tue, 15 April 2003 10:14 Go to previous message
condor is currently offline  condor
Messages: 35
Registered: January 2002
Member
"tomson" <tom2959@21cn.com> wrote in message news:<b75cmt$1ebn$1@mail.cn99.com>...
> for i=0,n_elements(y)-1 do begin
> .......
> endfor
>
>
> ERROR MESSAGE:
> Loop limit expression too large for loop variable type.
> <LONG ( 60214)>.
>
> But my program cannot do without that loop.


Others have replied to the issue at hand, but here's a general hint:
Some people (like me) only scan newsgroups occasionally, when we have
a minute, and at least I personally find it annoying when the subject
line of an article reads "help" or "I have a problem" or "How to solve
this problem?" -- it means that I have to retrieve that article and
read through it before I even know whether I am qualified to answer
it. Maybe it's about something I don't understand myself, and then it
seems it would be polite to give me at least a hint what you're
talking about in the subject line so I don't have to read your article
in the first place.

Had you chosen the error message itself as a "subject" ("Loop limit
expression too large for loop variable type") every reader of the
group would've known what your postis about and whether they know the
answer.

Even better: If you copy/paste the full error message into the
google-news interface
at http://groups.google.com/groups?group=comp.lang.idl-pvwave
you'll get the answer to your problem without even having to post. I
find this to be a good first step with all kinds of computer-related
questions, as it gives me a bit of an idea how common the problem at
hand is -- have others encountered it, how did they proceed, what
advice was given to them etc. Even if my question can't be answered
that way, I often find a useful hint that helps me solve my problem
myself.
Re: How to solve this problem? [message #34723 is a reply to message #34720] Tue, 15 April 2003 07:12 Go to previous message
Ken Knapp is currently offline  Ken Knapp
Messages: 14
Registered: April 2003
Junior Member
tomson wrote:
>
> for i=0,n_elements(y)-1 do begin
> .......
> endfor

It looks like it sets i to an integer, whereas it should be a long for
such a large number, so try:

for i=0l,n_elements(y)-1 do begin
.......
endfor

[that problem got me a while back and I panicked at first too]
Hope this helps.
-Ken

--
<>< <>< <>< <>< <>< <>< <>< <><
Kenneth Knapp CIRA Visiting Scientist
NOAA/NESDIS/ORA Ken.Knapp@noaa.gov
E/RA1, RM 711C, WWBG Phone:301-763-8053x195
5200 Auth Rd. Fax:301-763-8108
Camp Springs, MD 20746-4304
Re: How to solve this problem? [message #34752 is a reply to message #34723] Thu, 10 April 2003 20:39 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"tomson" <tom2959@21cn.com> wrote in message
news:b75cmt$1ebn$1@mail.cn99.com...
> for i=0,n_elements(y)-1 do begin
> .......
> endfor
>
>
> ERROR MESSAGE:
> Loop limit expression too large for loop variable type.
> <LONG ( 60214)>.
>
> But my program cannot do without that loop.

Change it to

for i=0L,n_elements(y)-1 do ...

or add the following declaration to the beginning of your code

compile_opt DEFINT32

When you set i to 0 at the beginning of the loop, this makes i a short
(16-bit) integer *unless* you explicitly specify a long integer (0L) or you
tell IDL that you want your default integer type to be long (32-bit). Short
integers can't go past 32767

---
--

Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
Re: How to solve this problem? [message #34753 is a reply to message #34752] Thu, 10 April 2003 20:36 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
tomson (tom2959@21cn.com) writes:

> for i=0,n_elements(y)-1 do begin
> .......
> endfor
>
>
> ERROR MESSAGE:
> Loop limit expression too large for loop variable type.
> <LONG ( 60214)>.
>
> But my program cannot do without that loop.

Make your loop variable a long integer:

FOR I=0L, N_Elements(y)-1 DO BEGIN

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: NetCDF I/O problems
Next Topic: socket generated event

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

Current Time: Wed Oct 08 18:55:55 PDT 2025

Total time taken to generate the page: 0.00499 seconds