Re: Where function inserting missing values. Why?

From: Bridget Thrasher <bthrasher_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 20 2009 - 17:04:29 MDT

Thanks, Dave! That actually worked! But I still don't understand why my
original statement didn't. What does lazy evaluation have to do with it?
Does this mean that any complex conditional statements used in a where
function is not being properly evaluated? For example, I've got the
following (and others like it) earlier on in my script:

q = where(nzeros20c.gt.(0.95*yrs20c) .and. nzerosobs.lt.(0.4*yrs20c) .and.
data_all(a*12+m,:,:).gt.0.,q_sh,q)

Thanks again,
Bridget

Date: Tue, 20 Oct 2009 16:43:15 -0600
> From: Dave Allured <dave.allured@noaa.gov>
> Subject: Re: Where function inserting missing values. Why?
> To: ncl-talk@ucar.edu
> Message-ID: <4ADE3D03.9020607@noaa.gov>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Bridget,
>
> Here is something else to try. In the code in your first message,
> try this in place of your last where statement:
>
> avg1 = mon_avg_obs(m,:,:)
> fmask = where(ismissing(avg1), False, avg1.eq.-2222)
> factors(a*12+m,:,:) = where(fmask, 0., factors(a*12+m,:,:))
>
> print("3. "+num(ismissing(factors(a*12+m,:,:))))
>
> "Lazy evaluation expression does not work for arrays." I wish I had
> seen this sooner.
>
> Dave Allured
> CU/CIRES Climate Diagnostics Center (CDC)
> http://cires.colorado.edu/science/centers/cdc/
> NOAA/ESRL/PSD<http://cires.colorado.edu/science/centers/cdc/%0ANOAA/ESRL/PSD>,
> Climate Analysis Branch (CAB)
> *** http://www.esrl.noaa.gov/psd/psd1/ ***
> NOTICE: NEW PSD1/CAB WEBSITE ADDRESS AS OF 2009-OCT-14
> PRODUCT AND DATA CONSUMERS PLEASE TAKE NOTE
>
> Bridget Thrasher wrote:
> > I am doing the following in a loop:
> >
> > mon_avg_obs(m,:,:) = where(mon_avg_obs(m,:,:).eq.0, -2222,
> > mon_avg_obs(m,:,:))
> > factors(a*12+m,:,:) = data_all(a*12+m,:,:)/mon_avg_20c(m,:,:)
> > print("1. "+num(ismissing(factors(a*12+m,:,:))))
> > factors(a*12+m,:,:) = where(.not.ismissing(mon_avg_obs(m,:,:)),
> > dvar(a*12+m,:,:)/mon_avg_obs(m,:,:), factors(a*12+m,:,:))
> > print("2. "+num(ismissing(factors(a*12+m,:,:))))
> > factors(a*12+m,:,:) =
> > where(.not.ismissing(mon_avg_obs(m,:,:)).and.mon_avg_obs(m,:,:).eq.-2222,
> > 0., factors(a*12+m,:,:))
> > print("3. "+num(ismissing(factors(a*12+m,:,:))))
> >
> >
> > The output on the screen says:
> > (0) 1. 0
> > (0) 2. 0
> > (0) 3. 11753
> >
> > Why is the last where statement inserting a fill value? I've tried it
> > with and without the .not.ismissing() part, as well as some other
> > things, but all yield the same result.
> >
> > -Bridget
> >
> >
> > --
> > Bridget Thrasher, PhD
> > Postdoctoral Researcher
> > Climate Central
> > www.climatecentral.org <http://www.climatecentral.org>
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 20 Oct 2009 22:48:15 +0000
> From: jam hong <cumarporn@hotmail.com>
> Subject: passing values
> To: <ncl-talk@ucar.edu>
> Message-ID: <SNT115-W6504954A10FEB6D80871F0A4C00@phx.gbl>
> Content-Type: text/plain; charset="windows-1256"
>
>
> Dear all
> I try to plot the observation data from IHOP_site21.txt with the
> wrf_output.
> The array dimension is 73. I read the files which have the same amount of
> array.
> I do not understand why I got all this error message (error.txt).
> Please give me some suggestion.
> Thanks
> Jam
>
>
>
> _________________________________________________________________
> Windows Live: Make it easier for your friends to see what you?re up to on
> Facebook.
>
> http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20091020/52c35697/attachment.html
> -------------- next part --------------
> An embedded and charset-unspecified text was scrubbed...
> Name: IHOP_site21.txt
> Url:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20091020/52c35697/attachment.txt
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: ts_panel_ihop_site2.ncl
> Type: application/octet-stream
> Size: 21461 bytes
> Desc: not available
> Url :
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20091020/52c35697/attachment.obj
> -------------- next part --------------
> An embedded and charset-unspecified text was scrubbed...
> Name: error.txt
> Url:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20091020/52c35697/attachment-0001.txt
>
> ------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> End of ncl-talk Digest, Vol 71, Issue 62
> ****************************************
>
Message: 2

-- 
Bridget Thrasher, PhD
Postdoctoral Researcher
Climate Central
www.climatecentral.org

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Oct 20 17:04:31 2009

This archive was generated by hypermail 2.1.8 : Thu Oct 22 2009 - 13:09:30 MDT