Re: If Statement - conditional expression yields a missing value

From: Daniel Barandiaran <dbarandiaran_at_nyahnyahspammersnyahnyah>
Date: Mon Sep 16 2013 - 16:50:21 MDT

I have come across this problem before, it happens when the value being
looked at in the boolean expression is a missing value, if I'm not
mistaken. Also, I looked at the where statement that you commented out and
doesn't work. I have also done something similar, but without the
subscripting. I'm not an expert on using the where function, but perhaps
you can try the following:

do hr=0,23
height_new(:,hr)= where(temp.lt.5,-999,height(:,hr))
end do

this would not be inside the i loop. You can do similar where statements
without the subscripting for the 1-D variables including temp, outside the
hr loop.

doing the height_new(:,:) would make the entire array -999. which is
probably not what you want. Also, the third argument in where says what
gets assigned to height_new if the boolean is false. The way you have it
written, temp would be assigned to height, which is also probably not what
you want.

Once again, I am not the expert here, but it is worth a shot at least, and
of course if any of the other users out there see a mistake in what I wrote
I am sure they will chime in.

Good luck!

On Mon, Sep 16, 2013 at 4:26 PM, Mike Pirhalla <glacierbayncl@gmail.com>wrote:

> I’m making a series of Hovmueller plots by plotting height levels in 24
> hour time series by 124 days.****
>
> The plot simply plots height levels, and works perfectly for what I need
> it to do. I also have temperature data for each corresponding height*. I
> want filter what I am plotting to only plot heights where the temperature
> is greater than 5.* When I attempt to set those temperature values and
> heights to -999 that are less than 5, I get this error: “fatal:The result
> of the conditional expression yields a missing value. NCL can not determine
> branch, see ismissing function.” ****
>
> Perhaps I’m going about this in an incorrect manner. The code for this
> portion is below, Thanks very much for any help.****
>
> ** **
>
> ; read in the data from the external file****
>
> do i=0,(nrow-1)****
>
> n=i****
>
> date(i) = a(n,0)****
>
> day(i) = a(n,1)****
>
> hour(i) = a(n,2)****
>
> lev(i) = a(n,3)****
>
> height(i) = a(n,4)****
>
> temp(i) = a(n,5)****
>
> end do****
>
> ** **
>
> height_new=new((/124,24/),float)****
>
> ** **
>
> do i=0,123 ; loop over all of the days in season (124)****
>
> a0=i*24 ; each day has 24 hours****
>
> a23=a0+23 ; last hour of day****
>
> height_new(i,0:23)=height(a0:a23) ;new variable for heights for each
> hour of the day****
>
> ** **
>
> ;height_new(:,:)= where(temp(i).lt.5,-999,temp(i)) ; this didn’t work****
>
> ** **
>
> if (temp(i) .lt. 5) then****
>
> temp(i)=-999****
>
> height_new(:,:)=-999****
>
> day(i)=-999****
>
> hour(i)=-999****
>
> date(i)=-999****
>
> lev(i)=-999****
>
> end if****
>
> ** **
>
> …skipping to the end I plot:****
>
> plot= gsn_csm_contour(wks,height_new(:,:),res)****
>
> ** **
>
> ---****
>
> Michael Pirhalla****
>
> Graduate Research Assistant****
>
> University of Alaska Fairbanks****
>
> Dept. of Atmospheric Sciences****
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

-- 
Danny Barandiaran
Department of Plants, Soils, and Climate
Utah State University

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Sep 16 16:50:31 2013

This archive was generated by hypermail 2.1.8 : Wed Sep 18 2013 - 17:07:30 MDT