[ncl-talk] Using loadscript within a do loop

Rick Brownrigg brownrig at ucar.edu
Wed Jun 8 10:55:26 MDT 2016


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> 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
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160608/e63e2321/attachment.html 


More information about the ncl-talk mailing list