Re: Fwd: how to ignore missing values in if statement

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Dec 07 2012 - 07:20:00 MST

[1] PLEASE ... do not submit the same question multiple times.
     ncl-talk is not a 7-day 24-hour service. People answer
     when they have time.

[2] Maybe ...

    if (.not.all(ismissing(conc))) then ; only proceed if there are
                                        ; non-missing values
        do lev=0,35
          do i=0,11
             if (.not.(ismissing(conc(lev ,i,istations)) .and. \
                       ismissing(conc(lev+1,i,istations))).and. \
                 conc(lev ,i,istations).lt.150 .and. \
                 conc(lev+1,i,istations).gt.150) then
                 sonde_h(i,istations) = (plev_sonde(lev) +
plev_sonde(lev+1))/2.
             end if
          end do
        end do

    end if

On 12/7/12 7:12 AM, H.Dang wrote:
> ---------- Forwarded message ----------
> From: H.Dang <danghy@gmail.com>
> Date: Thu, Dec 6, 2012 at 5:07 PM
> Subject: how to ignore missing values in if statement
> To: ncl-talk@ucar.edu
>
>
> Hi dear all,
>
> My data includes lots of missing values, I just want to know how to ignore
> these values in the following if judgements. My code is like:
>
> 74 do lev = 0,35
> 75 do i = 0,11
> 76 if
> (.not.all(ismissing(conc)).and.conc(lev,i,istations).lt.150.and.conc(lev+1,i,istations).gt.150)
> then
> 77 sonde_h(i,istations) = (plev_sonde(lev) +
> plev_sonde(lev+1))/2.
> 78 end if
> 79 end do
> 80 end do
>
> The error information is:
>
> fatal:The result of the conditional expression yields a missing value. NCL
> can not determine branch, see ismissing function
> fatal:["Execute.c":7556]:Execute: Error occurred at or near line 78 in file
> testmissing.ncl
>
> Thank you!
>
> Hongyan
>
>
>
> _______________________________________________
> 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 Fri Dec 7 07:20:19 2012

This archive was generated by hypermail 2.1.8 : Fri Dec 07 2012 - 13:30:06 MST