[ncl-talk] Some operation questions about list in NCL
Will Hobbs
will.hobbs at utas.edu.au
Wed Mar 6 20:17:39 MST 2019
Lucky
You can index an element within an array that is part of a list in exactly the same way that you can index a standalone array – just think of lista[2] as the array ‘c’. In your example:
>print( c(1) ) ;returns “two”
>print( lista[2](1) ) ;also returns “two”
From: ncl-talk <ncl-talk-bounces at ucar.edu> on behalf of 半个丑角 <644457443 at qq.com>
Date: Thursday, 7 March 2019 at 2:10 PM
To: ncl-talk <ncl-talk at ucar.edu>
Subject: [ncl-talk] Some operation questions about list in NCL
Dear NCL team or users,
Hello, every body! It's kind for you all to read my letter!
It was known that NCL have a data struction called list, into which we can store different types of data together. But I got confused about its operation to get an exact data from a list. To make my question more clearly, set the following codes as an example:
> begin
> a = (/1,2,3/)
> b = (/3,4,5,6,7/)
> c = (/"one","two"/)
> lista = [/a,b,c/]
> print(lista[2])
> end
As a result, in the screen, it will be:
> Variable: c
> Type: string
> Total Size: 8 bytes
> 2 values
> Number of Dimensions: 1
> Dimensions and sizes: [2]
> Coordinates:
> (0) one
> (1) two
My question is that, list[2] will get the third array in the list, but how can I get the elements in the third array one by one? how can I index "two" in my ncl script when I need to read it out?
I feel sorry to disturb you, but I do need a help. Again, thanks for reading my letter!
Cheers,
Lucky
University of Tasmania Electronic Communications Policy (December, 2014).
This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190307/c6d7c6db/attachment.html>
More information about the ncl-talk
mailing list