Re: strange do loop problem

From: ozan mert gokturk <zanmerto_at_nyahnyahspammersnyahnyah>
Date: Wed, 19 Dec 2007 09:19:08 -0800 (PST)

Hi Mary,

Thank you very much for your response. I solved the
problem with the help from Mr.Shea. The problem here
turned out to be that, I was using dimsizes(data(:,0))
IN the loop, which takes apparently infinite time
because "data" is composed of 4.5 million lines. I
mean, the line

do i=0, dimsizes(data(0,:) - 1

makes the loop last very very long, while using the
following two lines

iSize = dimsizes(data(0,:) - 1
do i=0, iSize

solves the problem! I just could not realize how long
that "dimsizes" function takes in every iteration.

Thanks again

Ozan

--- Mary Haley <haley_at_ucar.edu> wrote:

>
> Hi Ozan,
>
> I don't know if this was resolved, but I tried to
> reproduce this
> myself without much luck.
>
> Can you give us more information about what you are
> doing inside the
> loop, and what the full dimensions of "data" are?
> If you can give us
> the script and data so we can run it, that would be
> even better.
>
> Thanks,
>
> --Mary
>
> On Fri, 14 Dec 2007, Dennis Shea wrote:
>
> > Try
> >
> > iSize=dimsizes(data(:,0))
> > do i=0,iSize-1
> >
> > Perhaps, NCL evaluates dimsizes(data(:,0)) on
> each iteration?
> >
> >
> > ozan mert gokturk wrote:
> >> Dear NCL users,
> >>
> >> I am having a weird situation with a do loop.
> >>
> >> I have a loop processing approximately 1,660,000
> lines
> >> of ascii file. When i write
> >>
> >> do i=0, dimsizes(data(:,0)) - 1
> >>
> >> and proceed, loop never seems to be ending.
> >> "dimsizes(data(:,0))" equals 1,660,000. I have
> checked
> >> it. On the other hand, if I write
> >> do i=0, 1659999
> >>
> >> and proceed, do loop ends healthily!
> >>
> >> What could be the cause for this? Although I
> solved
> >> the problem by entering the exact number of
> iterations
> >> into the loop, I am not satisfied with my
> solution!!!
> >>
> >> Thanks for any idea...
> >>
> >> Ozan
> >>
> >>
> >>
>
____________________________________________________________________________________
> >> Be a better friend, newshound, and know-it-all
> with Yahoo! Mobile. Try it
> >> now.
>
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
> >> _______________________________________________
> >> ncl-talk mailing list
> >> ncl-talk_at_ucar.edu
> >> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >>
> >
> >
> > --
> >
>
======================================================
> > Dennis J. Shea tel: 303-497-1361
> |
> > P.O. Box 3000 fax: 303-497-1333
> |
> > Climate Analysis Section
> |
> > Climate & Global Dynamics Div.
> |
> > National Center for Atmospheric Research
> |
> > Boulder, CO 80307
> |
> > USA email: shea 'at'
> ucar.edu |
> >
>
======================================================
> >
> > _______________________________________________
> > ncl-talk mailing list
> > ncl-talk_at_ucar.edu
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >
>

      ____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Received on Wed Dec 19 2007 - 10:19:08 MST

This archive was generated by hypermail 2.2.0 : Mon Dec 31 2007 - 09:18:02 MST