Re: Where function inserting missing values. Why?

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 20 2009 - 16:43:15 MDT

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, 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
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Oct 20 16:43:12 2009

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