[ncl-talk] a quick question about array in ncl
Kyle Griffin
ksgriffin2 at wisc.edu
Wed Oct 8 11:09:14 MDT 2014
What you are setting with the third parameter in new(...) is not initial
values, but rather the _FillValue setting. Please read the documentation
here:
https://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml
As a result, you are saying "missing value + 0.1 = missing_value" and then
telling it to display the missing value as 1. Now, even if you set a=1,
which is the proper way to initialize the variables with a single value
regardless of dimensions, all values are still listed as "missing" because
you've set 1 to be the value in the variable that represents having no
data at any given location. Try this:
a=new(3,float)
b=(/.1,.2,.3)
a=1
print(a+b)
This should be good. Any other questions, please let the list know.
Kyle
----------------------------------------
Kyle S. Griffin
Department of Atmospheric and Oceanic Sciences
University of Wisconsin - Madison
Room 1421
1225 W Dayton St, Madison, WI 53706
Email: ksgriffin2 at wisc.edu
On Wed, Oct 8, 2014 at 11:54 AM, Liang Yu <lyu4 at masonlive.gmu.edu> wrote:
> Hi all,
>
>
> This is quick question.
>
> Why the output bellow is 1,1, 1?
>
> How can I get a+b=1.1, 1.2, 1.3?
>
>
>
>
> Best regards,
> --
> Liang
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141008/71bb26e3/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2014-10-07 at 1.26.30 PM.png
Type: image/png
Size: 51184 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141008/71bb26e3/attachment.png
More information about the ncl-talk
mailing list