Re: Possible bug (?) with lists in 6.2.0

From: Brian Vanderwende <simbjv_at_nyahnyahspammersnyahnyah>
Date: Fri May 09 2014 - 03:22:32 MDT

Thanks for the quick response. I know that you don't need the (/ /) in most
cases. However, the use of those delimiters seemed to fundamentally alter
the way lists worked in 6.1.0-beta, which I sometimes used to my advantage.
Here is perhaps a clearer example:

ncl 0> t1 = ispan(0,10,1)
ncl 1> t2 = NewList("fifo")
ncl 2> ListPush(t2, t1)
ncl 3> ListPush(t2, (/t1/))
ncl 4> print(ListCount(t2))
(0) 2
ncl 5> delete(t1)
ncl 6> print(ListCount(t2))
(0) 1

If I delete the original variable, the list object pointing to that
variable is also deleted. However, the one using the (/ /) remains.
Therefore, it seemed that in line 2, the list is adding a pointer reference
to the variable t1, whereas in line 3, the list gets its own storage of the
array in memory that is no longer tied to the variable t1.

Again, line 3 no longer works beyond version 6.1.0-beta, which may be
intentional. If so, I will need to find alternative approaches, but I want
to see if it is a bug before altering my codes.

Thanks again.
-Brian

> Message: 14
> Date: Fri, 09 May 2014 10:10:05 +0200
> From: Karin Meier-Fleischer <meier-fleischer@dkrz.de>
> Subject: Re: Possible bug (?) with lists in 6.2.0
> To: ncl-talk@ucar.edu
> Message-ID: <536C8D5D.2060502@dkrz.de>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Brian,
>
> you don't have to use (/test_data/) in the ListPush call just test_data:
>
> test_data = ispan(0,10,1)
> test_list = NewList("fifo")
> ListPush(test_list, test_data)
> print(test_list)
>
> test_list has only one dimension containing the list variable test_data.
> Using ListPop
> with fifo list type will return the first list variable if you pushed
> more list variables to
> test_list.
>
> See also: http://ncl.ucar.edu/Document/Functions/Built-in/ListPop.shtml
>
> Hope this will help,
> Karin
>
> Am 09.05.14 09:33, schrieb Brian Vanderwende:
> > Hello,
> >
> > I'm running into a potential bug with list variables in NCL 6.2.0 (and
> > apparently 6.1.x). In 6.1.0-beta, I would often disassociate data from
> > their parent variable when adding it to a list so that I could return
> > lists of data of various types from functions without worrying about
> > keeping around the original variable. Simple example (sans function):
> >
> > test_data = ispan(0,10,1)
> > test_list = NewList("fifo")
> > ListPush(test_list, (/test_data/))
> > print(test_list[0])
> >
> > That code ran fine in 6.1.0-beta, but since I've upgraded to 6.2.0,
> > I've been getting the following error at the print statement:
> >
> > fatal:["Execute.c":1939]:Internal error
> > fatal:["Execute.c":8565]:Execute: Error occurred at or near line 3
> >
> > Perhaps this behavior is intended, as I'm not really using lists in
> > the way they were conceived, but I found it to be quite a useful
> > coding trick in 6.1.0-beta.
> >
> > System information from uname:
> > Linux 2.6.32-358.11.1.2chaos.ch5.1.x86_64 #1 SMP Wed Jul 24 17:45:01
> > PDT 2013 x86_64 x86_64 x86_64 GNU/Linux
> >
> > Regards,
> > -Brian
> >
> > --
> > Brian Vanderwende - PhD Student
> > Atmospheric and Oceanic Science, University of Colorado Boulder
> > Phone: (303)492-2654
> > --
> >
> >
> > _______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> --
> Dipl. Geophys. Karin Meier-Fleischer
> Application Support, Visualization
>
> Deutsches Klimarechenzentrum GmbH E-Mail: meier-fleischer@dkrz.de
> Bundesstrasse 45a Internet: http://www.dkrz.de/
> 20146 Hamburg Phone: +49 (0)40 460094 126
> Germany Fax: +49 (0)40 460094 270
>
> Gesch?ftsf?hrer: Prof. Dr. Thomas Ludwig
> Sitz der Gesellschaft: Hamburg
> Amtsgericht Hamburg HRB 39784
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140509/2cf430eb/attachment.html
>
> ------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> End of ncl-talk Digest, Vol 126, Issue 11
> *****************************************
>

-- 
Brian Vanderwende - PhD Student
  Atmospheric and Oceanic Science, University of Colorado Boulder
  Phone: (303)492-2654
--

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri May 9 03:22:43 2014

This archive was generated by hypermail 2.1.8 : Fri May 09 2014 - 15:23:17 MDT