Re: Where function inserting missing values. Why?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 20 2009 - 14:02:17 MDT

On topics like this, it is a good idea to include a printVarSummary
as suggested by Wei. Specifically,

    printVarSummary( mon_avg_obs )
    printMinMax( mon_avg_obs, True ) ; contributed.ncl

before you do any of the operations indicated below. The information
can be quite useful.

Also,

    printVarSummary( factors(a*12+m,:,:) )
    printMinMax(factors(a*12+m,:,:), true)

  

---
The one thing different with the  last 'where'  is the    .and.
 ... where( .not.ismissing(mon_avg_obs(m,:,:)) .and. 
mon_avg_obs(m,:,:).eq.-2222,...)
print("debug: "+num( .not.ismissing(mon_avg_obs(m,:,:)) .and. 
mon_avg_obs(m,:,:).eq.-2222) )
   
Bridget Thrasher wrote:
> They all have a FillValue of 1.0e20. Any other ideas? I'm truly stumped!
>
> On Tue, Oct 20, 2009 at 12:04 PM, Wei Huang <huangwei@ucar.edu 
> <mailto:huangwei@ucar.edu>> wrote:
>
>     Briget,
>
>     Check _FillValue of mon_avg_obs, data_all, factors
>     with command printVarSummary(the_var).
>
>     It is likely, that variable factors has _FillValue of 0.
>
>     Regards
>
>     Wei Huang
>     huangwei@ucar.edu <mailto:huangwei@ucar.edu>
>     VETS/CISL
>     National Center for Atmospheric Research
>     P.O. Box 3000 (1850 Table Mesa Dr.)
>     Boulder, CO 80307-3000 USA
>     (303) 497-8924
>
>
>
>
>
>     On Oct 20, 2009, at 10:31 AM, 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
>   
-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Oct 20 14:02:16 2009

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