Re: MultiDValDelParent

From: Rob Nicholas <rnicholas_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 17 2010 - 13:01:25 MDT

Mary,

Thanks for your explanation. What's still confusing, though, is that (say)
"test_foo(6)" works but "wrap_foo(6)" throws the fatal error. Am I just
misunderstanding how variable scope works in this situation?

~Rob

On Wed, Mar 17, 2010 at 11:49 AM, Mary Haley <haley@ucar.edu> wrote:

> Rob,
>
> You are right, array_append_record is trying to modify the first argument,
> and the documentation as much:
>
> Return value
>
> A multi-dimensional array. The rightmost dimensions will be the same as
> on input. The left dimension will have additional records appended to the x1
> array.
>
> You are calling array_append_record with:
>
> x = array_append_record( (/m/), (/1,2/), 0 )
>
> When you do the "(/m/)", you are effectively just passing in a bunch of
> values, rather than a variable.
>
> The array_append_record function wants to change that first argument by
> attaching some dimension names
> to it. Since you passed in a bunch of values and not a variable, there's
> nothing to attach the dimension
> names to. It would be like trying to do this:
>
> 3.14!0 = "lat"
>
>
> So, yes, the fix is to use "m" instead of "(/m/)".
>
> --Mary
>
> On Mar 16, 2010, at 11:38 AM, Rob Nicholas wrote:
>
> Hi NCLers,
>
> Could anyone explain (in a general sense) what's going on when NCL
> generates a
>
> fatal:MultiDValDelParent: Attempt to delete parent from empty
> list
>
> error? To get NCL to throw the error, I first define the following
> two simple procedures:
>
> undef("test_foo")
> procedure test_foo( m:integer )
> local x
> begin
> x = array_append_record( (/m/), (/1,2/), 0 )
> end
>
> undef("wrap_foo")
> procedure wrap_foo( n )
> begin
> test_foo( n )
> end
>
> So defined, "test_foo(5)" executes without a problem, but
> "wrap_foo(5)" throws the fatal error. I've been able to replicate the
> behavior with NCL 5.1.0 on RHEL and NCL 5.1.1 on Snow Leopard.
>
> I've found two different ways to eliminate the error. One is simply
> changing "(/m/)" to "m" in test_foo(). The other fix is to redefine
> wrap_foo() as follows:
>
> undef("wrap_foo")
> procedure wrap_foo( n )
> local nn
> begin
> nn = n
> test_foo( nn )
> end
>
> Could any of the developers explain what's going on here? It seems
> like array_append_record() may be trying to modify its first argument
> -- should it be doing that?
>
> Thanks,
> Rob
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
Received on Wed Mar 17 13:01:41 2010

This archive was generated by hypermail 2.1.8 : Thu Apr 01 2010 - 11:31:45 MDT