Re: Where function inserting missing values. Why?

From: Bridget Thrasher <bthrasher_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 20 2009 - 14:57:54 MDT

OK, here's what I'm printing now:

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,:,:))))

printVarSummary(mon_avg_obs)
printMinMax(mon_avg_obs,True)
printVarSummary(factors(a*12+m,:,:))
printMinMax(factors(a*12+m,:,:),True)
print("debug:
"+num(.not.ismissing(mon_avg_obs(m,:,:)).and.(mon_avg_obs(m,:,:).eq.-2222)))

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,:,:))))

With the result being:

(0) 1. 0
(0) 2. 0

Variable: mon_avg_obs
Type: float
Total Size: 790608 bytes
            197652 values
Number of Dimensions: 3
Dimensions and sizes: [month | 12] x [lat | 91] x [lon | 181]
Coordinates:
            month: [0..11]
            lat: [ -90.. 90]
            lon: [ 0.. 360]
Number Of Attributes: 3
  info : function clmMonLLT: contributed.ncl
  time_op_ncl : Climatology: 50 years
  _FillValue : 1e+20
(0)
(0) min=-2222 max=41.1583

Variable: factors (subsection)
Type: float
Total Size: 65884 bytes
            16471 values
Number of Dimensions: 2
Dimensions and sizes: [lat | 91] x [lon | 181]
Coordinates:
Number Of Attributes: 1
  _FillValue : 1e+20
(0)
(0) min=0 max=14.1053
(0) debug: 2
(0) 3. 11753

I still don't see what's wrong. Am I missing something glaring?

-Bridget

On Tue, Oct 20, 2009 at 1:02 PM, Dennis Shea <shea@ucar.edu> wrote:

> 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) )
>
>
>
>
>
>
>
>
>

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

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