Missing values and divide by zero

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Sun Apr 15 2012 - 18:14:20 MDT

NCL support team,

There seems to be inconsistent behavior when the numerator is a
missing value in simple division. In the scalar case:

(1) missing value / 0 gives missing value

In the array case:

(2) missing value / 0 gives a fatal error

My interpretation of the current NCL manual is that (1) is the correct
behavior, and (2) is wrong. Also, (1) is best behavior for clean user
programming. I request that NCL be changed to correctly handle the
array case. Either way, would you please explicitly document the
expected behavior for (missing divided by zero) in the NCL manual?

There is a general workaround for user programs, by setting zeros in
the denominator array to missing values. This is less desirable in
user cases when missing value information is already contained in the
numerator array.

I found this behavior consistently through several versions of NCL
5.2.0 through NCL 6.0.0 on Linux and Mac.

Following is a short test case which ends in a fatal error. Thank you
for your consideration.

begin
   a = new (3, float)
   a(0) = 3.3
   a(2) = 5.5
   print ("A missing = " + ismissing (a))
   print (a)

; Note, a(1) should be a missing value.

   b = (/ 4, 0, 4 /)
   print (b)

   c = a / b
   print (c)
end

--Dave
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Apr 15 18:14:28 2012

This archive was generated by hypermail 2.1.8 : Fri Apr 20 2012 - 16:21:18 MDT