[ncl-talk] Using loadscript within a do loop
Lech Lobocki
llobocki at is.pw.edu.pl
Thu Jun 9 01:29:10 MDT 2016
Luke,
and what about using a function or a procedure?
Lech
W dniu 09.06.2016 o 04:16, Luke Osburn pisze:
> Hi,
>
> The do loop that I use loads a sequence of .hdf files and I need to
> run about several hundred lines of code on it. The only alternative
> that I can think of is to have literally a do loop with several
> hundred lines of code in it. Surely there has to be a better way?
>
> Cheers
> Luke
>
> On 9 June 2016 at 02:55, Rick Brownrigg <brownrig at ucar.edu
> <mailto:brownrig at ucar.edu>> wrote:
>
> Hi Luke,
>
> It looks like what we are seeing is that each call to loadscript()
> is a directive to load script that is to be queued-up and executed
> at the conclusion of the loop. I don't get that understanding
> from the docs, and I can't say if its intended behavior or not.
>
> In any case, I'm not sure what you are trying to do, but
> repeatedly loading a script inside a loop sounds like a lot od
> duplication and performance overhead. Is there other way to
> refactor your code?
>
> Rick
>
> On Wed, Jun 8, 2016 at 2:18 AM, Luke Osburn
> <luke.osburn at monash.edu <mailto:luke.osburn at monash.edu>> wrote:
>
> Hi all,
>
> I have run into something of a problem. I have a lot of code
> that needs to run on a lot of data and anticipated being able
> to use the loadscript function within do loops but it works in
> an odd way: a much simpler example:
>
> "Original script"
> do ray=0,3
> loadscript("sunshine.ncl")
> end do
>
> Where sunshine.ncl is:
>
> xx=ray*2
> print(xx)
>
> The output of this combination of scripts is:
>
> 8
> 8
> 8
> 8
>
> But I want to be able to use the value of ray in
> "Sunshine.ncl" as it loops and get:
>
> 0
> 2
> 4
> 6
>
> If anyone knows how to achieve something like this or a
> workaround that would be greatly appreciated.
>
> Regards
> Luke
>
>
> There were no errors reported.
> NCAR Command Language Version 6.3.0
> Linux s0000965 3.2.0-23-generic-pae #36-Ubuntu SMP Tue Apr 10
> 22:19:09 UTC 2012 i686 i686 i386 GNU/Linux
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
--
-------------------------------------------------------------------------
Lech Łobocki, Ph.D., D.Sc.
Professor,
Department of Environmental Engineering
Warsaw University of Technology
00-653 Warszawa, Nowowiejska 20, Poland
Tel. +48(22) 234-7606
fax: +48(22) 625-4305
e: lech.lobocki at is.pw.edu.pl
http://www.meteo.is.pw.edu.pl/
-------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160609/dadc5b35/attachment.html
More information about the ncl-talk
mailing list