[ncl-talk] missing value and index
Jatin Kala
jatin.kala.jk at gmail.com
Tue Feb 10 14:44:56 MST 2015
ncl 0> A=(/1,12,3,14,5,26,7,18,9,10/)
ncl 1> B=(/1,3,5/)
ncl 2> C=new(dimsizes(A),typeof(A))
ncl 3> C at _FillValue = -999
ncl 4> C(B) = A(B)
ncl 5> print(C)
Variable: C
Type: integer
Total Size: 40 bytes
10 values
Number of Dimensions: 1
Dimensions and sizes: [10]
Coordinates:
Number Of Attributes: 1
_FillValue : -999
(0) -999
(1) 12
(2) -999
(3) 14
(4) -999
(5) 26
(6) -999
(7) -999
(8) -999
(9) -999
On 11/02/15 8:14 AM, Xi Chang wrote:
> Dear NCL,
>
> How can I change the values which are not associated with list of
> index to be missing values, for instance let's say I have set of data
> in array A, and list of index in array B,
> then I need to get array C where, the values of A which are not
> associated with indices in B, will be missing values?
>
> A=(/1,12,3,14,5,26,7,18,9,10/) ;data
> B=(/1,3,5/) ;index
>
> then, the result will be:
>
> C=(/-999, 12, -999, 14,-999,26, -999, -999, -999, -999/)
>
> Thank you.
>
>
> _______________________________________________
> 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/20150211/cd40b698/attachment.html
More information about the ncl-talk
mailing list