[ncl-talk] Debug mode

Mary Haley haley at ucar.edu
Sat Apr 16 16:09:20 MDT 2016


Yongli,

Sorry, this is not a very informative error message!

I believe this is coming from the "toint" function, and is caused if you
try to convert a large float or double precision value to an integer that
would cause you to lose precision.

An example of this is:

x = 3^31      ;  6.176734e+14, too large for an integer variable
print(x)
i = toint(x)  ; triggers the "larger than INT_MAX" error
print(i)      ; -2147483647 (integer missing value)

I would check if you are calling "toint" anywhere in your code, and then
you will have to decide what to do with values that are too large. For
example, you could try "tolong" instead:

x = 3^31      ;  6.176734e+1
print(x)
i = tolong(x)
print(i)      ;   617673406808064

You could also do something with these large values before you convert them:

  x at _FillValue = -999
  x = where(x.ge.(2^31-1),x at _FillValue,x)
  i = toint(x)    ; Last value will be -999

--Mary


On Sat, Apr 16, 2016 at 8:30 AM, Sitan Heyl <heylsitan at gmail.com> wrote:

> Hi, all
>   I have an warning "there is 1 float larger than INT_MAX, which has been
> flagged missing". I need find where this warning occurs. Because this
> program need a long time to run, I wonder whether there is mode to debug
> the program or return an interactive mode and don't exit after running
> script. Any help is welcoming!
>
> Bests,
> YONGLI
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160416/e4fe5cd2/attachment.html 


More information about the ncl-talk mailing list