Re: "Nested too deeply" error without any nesting

From: David Ian Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed, 18 Jul 2007 17:27:35 -0600

Hi Jack,
The answer to this question is related to the numerous caveats that are
sprinkled throughout the documentation for the 'loadscript' procedure.
The
short answer is that yes there is a limit on the 'nesting' of loads --
it is currently
set to 20. This number could be adjusted upwards to some extent if that
would
help you solve your problem, but it would probably need to remain a
relatively
small number -- we could try 100, for instance.

And yes, the word 'nested' is somewhat misleading in the error message.
In this
case, what it really means is that there is a limit to the number of
scripts that are
still in the process of loading. As the caveats in the documentation
state, the
contents of the script cannot be accessed within the block that
contains the loadscript
call. The term block includes the interior statements of a DO loop. The
loading is only
completed when the block ends. Statements in the loaded scripts that
are outside of
functions or procedures are executed after the block ends --- in
reverse order of the order in
which they were loaded. I am attaching a set of scripts that should
make this behavior
clear. Untar loadscript.tar somewhere, then do

ncl test-loadscript.ncl

The loadscript function was a solution for 2 deficiencies of the "load"
command.

1) It is able to be called conditionally based on an IF test.
2) The filename argument can be a variable as well as a literal string

It was made available because it was a workable solution for certain
problems. Unfortunately
it is still not what we would like -- a way to conditionally cause
external code to be
inserted at any point in an NCL script and execute immediately. Its
behavior is frankly rather odd.
But other than the somewhat misleading error message and the limit you
have encountered in its
use, it is behaving as is documented. I hope we can produce an improved
version of 'loadscript'
sometime but I can't promise it will be soon. If bumping up the number
of allowable 'nestings'
would help let us know.
  -dave

On Jul 10, 2007, at 10:54 PM, Jack Glendening wrote:

> I had an NCL file containing numerous "load" statements, many within a
> DO loop which looped to plot many different parameters, which worked
> without any problems. I then needed to apply the statements in those
> "loaded" files (which did not contain procedures/functions) only in
> certain cases so I replaced each "load" with "loadscript" within an IF
> test. That bombed after the 18th parameter with an "Includes nested
> too deeply" error message. None of the loaded files calls the other,
> i.e. there is no nesting of the loads - in fact, for testing I can make
> all the loaded files emply files and still get the same error. I can
> run the program for the parameter at which bombs individually, sans
> loop, without any error. This leads me to wonder whether the error
> might result from the large number of "loadscript"s which are being
> called rather from any nesting. Do you have any guidance on this?
>
> FYI I do have a workaround - I simply reverted to the use of "load"
> and put the IF test within the loaded files, but there are reasons for
> preferring to put the IF test within the NCL script, not in the loaded
> files.
>
> I'm running NCL version 4.2.0.a034
>
> Jack
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Wed Jul 18 2007 - 17:27:35 MDT

This archive was generated by hypermail 2.2.0 : Wed Jul 18 2007 - 17:38:12 MDT