Re: How to work with lists?

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed May 05 2010 - 16:09:11 MDT

Hi Sebastian,

NCL's facilities for working with the list type are rudimentary and
undocumented.
There are functions NewList, ListPush, and ListPop:

ncl 0> l = NewList("join")
ncl 1> ListPush(l,"a string")
ncl 2> i = (/20,30,40/)
ncl 3> ListPush(l,i)
ncl 4> x = ListPop(l)
ncl 5> print(x)

Variable: x
Type: string
Total Size: 4 bytes
             1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) a string

The current version of NCL does not give any useful information if you
try to print the contents of a list, and there is no function to
return the number of elements in the list. We are currently working on
some enhancements for the list type to make it more functional.
  -dave

On May 4, 2010, at 3:46 AM, Sebastian Schubert wrote:

> Hi,
>
> the addfiles command returns a list. How can I work with these lists
> more
> than just using it for input? Especially, how can I
> * get the length of a list (a dimsizes for lists),
> * create a list manually?
>
> Can lists be used for collecting arrays of different dimensions?
>
> Cheers,
> Sebastian
>
> --
> Potsdam Institute for Climate Impact Research (PIK)
> Research Domain II - Climate Impacts & Vulnerabilities
> http://www.pik-potsdam.de/members/schubert/
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed May 5 16:09:16 2010

This archive was generated by hypermail 2.1.8 : Fri May 07 2010 - 10:36:00 MDT