[ncl-talk] create string array

Jared Lee jaredlee at ucar.edu
Sat Dec 12 23:01:47 MST 2015


Hi Tabish,

The error tells you what's wrong. The function 'new' is used to define the
dimensions of a new variable and the variable type, not to assign the
contents of the array. See the documentation here:

http://ncl.ucar.edu/Document/Functions/Built-in/new.shtml

So using your example above, you could do one of the following:

a = new(12, string)
a = (/"0530","0730","0930","1130","1330","1530","1730","
1930","2130","2330","0130","0330"/)

And in the example above, you wouldn't even need to define 'a' with the
'new' function. You could simply assign the array of strings to 'a' without
first defining it.

I hope that helps get you pointed in the right direction.

Jared

On Sat, Dec 12, 2015 at 5:52 PM, Tabish Ansari <tabishumaransari at gmail.com>
wrote:

> Hi
>
> I am trying to use a string array inside an XY plot. This is to represent
> time on the x-axis. I am using the following line:
>
> a =
> new((/"0530","0730","0930","1130","1330","1530","1730","1930","2130","2330","0130","0330"/),string)
>
> However, I am getting this error message:
>
>
> *fatal:New: the dimension size parameter is the wrong type an integer
> value was expected*
> What am I doing wrong here?
>
>
> Thanks in advance!
>
> Tabish
>
> Tabish U Ansari
> PhD student, Lancaster Environment Center
> Lancaster Univeristy
> Bailrigg, Lancaster,
> LA1 4YW, United Kingdom
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 
===============================
Jared A. Lee, Ph.D.
Project Scientist I
Research Applications Laboratory
National Center for Atmospheric Research
Boulder, Colorado, USA

Email: jaredlee at ucar.edu (w)
Phone: 303.497.8485 (w)
Web: https://staff.ucar.edu/users/jaredlee
===============================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151212/65358c18/attachment.html 


More information about the ncl-talk mailing list