Re: Missing value

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon, 12 Dec 2005 20:29:41 -0700 (MST)

> I use NCL to do algebraic calculations. When one of the variables is missing value, the result will be missing too. But I really want to ignore the missing value, just get the real value.
>
> For example,
>
> a = (/1,2,3,4,-999/)
> a@_FillValue = -999
> b = (/2,3,4/)
> c = a(2:) + b
> result: c = (/ 5,7, -999/)
>
> Is there any way to let 'c = (/5,7,4/)' ?
>
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
--------------------------------------------------------

print(a(2:))

Variable: a (subsection)
Type: integer
Total Size: 12 bytes
3 values
Number of Dimensions: 1
Dimensions and sizes: [3]
Coordinates:
Number Of Attributes: 1
_FillValue : -999
(0) 3
(1) 4
(2) -999

i = ind(ismissing(a(2:))) ; will return "2"
c = a(2:) + b
if (.not.ismissing(i)) then
c(i) = b(i)
end if
print(c)

Variable: c
Type: integer
Total Size: 12 bytes
3 values
Number of Dimensions: 1
Dimensions and sizes: [3]
Coordinates:
Number Of Attributes: 1
_FillValue : -999
(0) 5
(1) 7
(2) 4

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Dec 12 2005 - 20:29:41 MST

This archive was generated by hypermail 2.2.0 : Tue Dec 13 2005 - 09:37:24 MST