# Re: Werid Problem

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Sep 22 2011 - 12:55:19 MDT

I speculate that the 999.9 is not being *exactly* represented.

eps = 1e-5
aam = 999.9-eps
aap = 999.9+eps
aa = mask(aa, aa.eq.-99.0 .or. \
(aa.ge.aam .and. aa.le.aap), aa@_FillValue)

On 9/22/11 9:10 AM, Michael Garay wrote:
> Hi Cheung,
>
> I'll bet the problem is with requiring equality (.eq.) for a double
> precision value of 999.9. The fact that your approach works for –99.0
> but not for 999.9 suggests this might be the case. A simple solution
> would be to replace "aa.eq.999.9" with "aa.ge.999.0" (as long as all
> numbers greater than 999 are also supposed to be replaced with the
> default missing value.
>
> Hope this helps.
>
> - Mike Garay
>
> From: Cheung <zuibeidemei@126.com <mailto:zuibeidemei@126.com>>
> Date: Thu, 22 Sep 2011 22:36:34 +0800 (CST)
> To: <ncl-talk@ucar.edu <mailto:ncl-talk@ucar.edu>>
> Subject: Werid Problem
>
> Dear all:
>
> I have to replace 2 specified values (-99.0 and 999.9) into default
> missing value -9999. , in a double array (say aa). But Whatever methods
> I took, say:
>
> aa = mask(aa, aa.eq.-99.0, False)
>
> Or Loop and if case:
>
> do i = 0, dimsizes(aa)-1
> if(aa(i).eq.-99.0)then
> aa(i) = -9999.0
> end if
> if(aa(i).eq.999.9) then
> aa(i) = -9999.0
> end if
> end do
>
> It just can only substitute the -99.0 into -9999.0, doesn't work to
> 999.9, can anyone tell me why and how??
>
>
> Regards
>
> Cheung
>
>
>
>
> _______________________________________________ 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
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 22 14:55:26 2011

This archive was generated by hypermail 2.1.8 : Thu Sep 22 2011 - 17:12:44 MDT