Re: missing value problems

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu, 3 Aug 2006 18:09:53 -0600 (MDT)

> I have a netcdf file in which variable "b" (64X128) has some values and some
> missing places ( means there is no values).
>
> I assign the missing place in variable b as -999. But when I use the
> variable b in a if statement, I will get the error given below
>
> fatal:The result of the conditional expression yields a missing value. NCL
> can not determine branch, see ismissing function
>
> ^Mfatal:Execute: Error occurred at or near line 67 in file deb_1.ncl
>
> I give the some line of the program below

LOOP A:

> do i=0,63
> do j=0,127
> if (any(ismissing(b(0,i,j))) )then
               ^^^^^^^^^ only valid if b has _FIllValue attribute set
http://www.ncl.ucar.edu/Document/Functions/Built-in/ismissing.shtml
> b(0,i,j)=-999.
> end if
> end do
> end do
>
> b@_FillValue=-999.

LOOP A: If you have an array b(K,I,J) which does not have
         the _FillValue, then just setting

         b@_FillValue = -999.

is adequate. You do *not* need do loops.
---------------------------------------

LOOP B
> do i = 0,63
> do j = 0,127
> if(b(0,i,j).gt.6) then
> b(0,i,j) = 6
         end if <--
> end do
> end do
>
> I got the error in the indicated (<--) "end if statement"

I do not know why you got this error. There is nothing wrong.
Also, the above do loops can be replaced with

     b(0,:,:) = b(0,:,:) > 6 ; replace all values gt 6 with 6

>
> Could you please tell me how will I slove it with out assigning
>
> do i=0,63
> do j=0,127
> if(any(ismissing(phi(i,j)))) then
> phi(i,j)=0
> end if
> end do
> end do

  If phi@_FillValue exits

   phi_1d = ndtooned( phi )
   ii = ind(ismissing(phi_1d))
   phi_1d(ii) = 0
   phi = onedtond(phi_1d, dimsizes(phi))

good luck

---------------------------------------------------------

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Aug 03 2006 - 18:09:53 MDT

This archive was generated by hypermail 2.2.0 : Fri Aug 04 2006 - 10:26:31 MDT