# Re: Werid Problem

From: Debasish <debasish_at_nyahnyahspammersnyahnyah>
Date: Thu Sep 22 2011 - 09:00:08 MDT

Dear Cheung

you can try following

if (any(aa.eq.-99.0)) then
aa1D = ndtooned (aa) ; convert to 1D array
i50 = ind(aa1D.eq.-99.0) ; all indices x1D > 50
aa1D(i50) = -9999. ; set all array syntax
delete (aa1D) ; x1D no longer needed
delete (i50) ; i50 no longer needed
end if

if (any(aa.eq.999.9)) then
aa1D = ndtooned (aa) ; convert to 1D array
i50 = ind(aa1D.eq.999.9) ; all indices x1D > 50
aa1D(i50) = -9999. ; set all array syntax
delete (aa1D) ; x1D no longer needed
delete (i50) ; i50 no longer needed
end if
aa@_FillValue = -9999.

Thanks

Debasish

On 2011-09-22, at 10:36, Cheung wrote:

> Dear all:
>
> I have to replace 2 specified values (-99.0 and 999.9) into default missing value -9999. , in a double array (say aa). But Whatever methods I took, say:
>
> aa = mask(aa, aa.eq.-99.0, False)
>
> Or Loop and if case:
>
> do i = 0, dimsizes(aa)-1
> if(aa(i).eq.-99.0)then
> aa(i) = -9999.0
> end if
> if(aa(i).eq.999.9) then
> aa(i) = -9999.0
> end if
> end do
>
> It just can only substitute the -99.0 into -9999.0, doesn't work to 999.9, can anyone tell me why and how??
>
>
> Regards
>
> Cheung
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 22 10:55:52 2011

This archive was generated by hypermail 2.1.8 : Thu Sep 22 2011 - 17:12:44 MDT