[ncl-talk] Minor concerns for the "num" function

Rashed Mahmood rashidcomsis at gmail.com
Wed Aug 14 03:25:09 MDT 2019


Hi All,
My concern is ignoring "0" when the num and it's relatives (dim_num*)
functions do a counting when NOT evaluating a certain condition.  I do know
that it is clearly written in the documents that "All numerical values *except
for 0* evaluate to True."

My concern is that* if someone forgets about this "0" exception*, things
could go very wrong: Here is how:

ab = fspan(0,30,20)
  print(num(ab)+" ... "+dim_num_n(ab,0)+" ... "+num(ab.ge.0)+" ...
"+dimsizes(ab))
(0) 19 ... 19 ... 20 ... 20

  cd = (/9,10,0,0,0,5,8./)
  print(num(cd)+" ... "+dim_num_n(cd,0)+" ... "+dimsizes(cd))
(0) 4 ... 4 ... 7

But these does not fail and give fatal error when used without any
condition, although there is not so helpful warning message. The concern is
that if these cannot provide right answer these must give error message
suggesting that 0 values occurred while counting or something similar?


Cheers,
Rashed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190814/b839a22f/attachment.html>


More information about the ncl-talk mailing list