[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IDV #BWP-558582]: Testing for NaNs in formulas

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: [IDV #BWP-558582]: Testing for NaNs in formulas
  • Date: Thu, 07 Feb 2013 09:17:58 -0700

> Hello IDV support,
> 
> When I use the code you supplied I get the following error:
> 
> Creating display: Point Cloud
> > java.lang.ArrayIndexOutOfBoundsException:
> > java.lang.ArrayIndexOutOfBoundsException: 0
> > 0
> >
> 
> Details:
> 
> java.lang.ArrayIndexOutOfBoundsException: 0
> >     at
> > org.python.core.PyReflectedFunction.throwBadArgError(PyReflectedFunction.java:300)
> >     at
> > org.python.core.PyReflectedFunction.throwError(PyReflectedFunction.java:321)
> >     at
> > org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:167)
> >     at
> > org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
> >     at org.python.core.PyObject.__call__(PyObject.java:387)
> >     at org.python.core.PyObject.__call__(PyObject.java:391)
> >     at org.python.pycode._pyx101.isNaN$1(<string>:5)
> >     at org.python.pycode._pyx101.call_function(<string>)
> >     at org.python.core.PyTableCode.call(PyTableCode.java:165)
> >     at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
> >     at org.python.core.PyFunction.__call__(PyFunction.java:317)
> >     at org.python.pycode._pyx101.log10_py$2(<string>:11)
> >     at org.python.pycode._pyx101.call_function(<string>)
> >     at org.python.core.PyTableCode.call(PyTableCode.java:165)
> >     at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
> >     at org.python.core.PyFunction.__call__(PyFunction.java:317)
> >     at org.python.pycode._pyx104.f$0(<string>:1)
> >     at org.python.pycode._pyx104.call_function(<string>)
> >     at org.python.core.PyTableCode.call(PyTableCode.java:165)
> >     at org.python.core.PyCode.call(PyCode.java:18)
> >     at org.python.core.Py.runCode(Py.java:1261)
> >     at org.python.core.__builtin__.eval(__builtin__.java:484)
> >     at org.python.core.__builtin__.eval(__builtin__.java:488)
> >     at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:190)
> >     at
> > ucar.unidata.data.DerivedDataChoice.getData(DerivedDataChoice.java:782)
> >     at ucar.unidata.data.DataChoice.getData(DataChoice.java:637)
> >     at ucar.unidata.data.DataInstance.getData(DataInstance.java:243)
> >     at ucar.unidata.data.DataInstance.getData(DataInstance.java:207)
> >     at ucar.unidata.data.DataInstance.dataOk(DataInstance.java:295)
> >     at
> > ucar.unidata.idv.control.DisplayControlImpl.checkIfDataOk(DisplayControlImpl.java:3118)
> >     at
> > ucar.unidata.idv.control.DisplayControlImpl.initializeDataInstance(DisplayControlImpl.java:3215)
> >     at
> > ucar.unidata.idv.control.DisplayControlImpl.setData(DisplayControlImpl.java:3183)
> >     at
> > ucar.unidata.idv.control.PointCloudControl.setData(PointCloudControl.java:700)
> >     at
> > ucar.unidata.idv.control.PointCloudControl.init(PointCloudControl.java:471)
> >     at
> > ucar.unidata.idv.control.DisplayControlImpl.init(DisplayControlImpl.java:1450)
> >     at
> > ucar.unidata.idv.control.DisplayControlImpl.init(DisplayControlImpl.java:1131)
> >     at
> > ucar.unidata.idv.ControlDescriptor.initControl(ControlDescriptor.java:986)
> >     at ucar.unidata.idv.ControlDescriptor$1.run(ControlDescriptor.java:911)
> >     at ucar.unidata.util.Misc$3.run(Misc.java:1250)
> >
> 
> Have you tested against data containing NaNs?
> 
> I was getting this error before, which is why I contacted support in the
> first place.
> 
> Thank you.
> 

The code has been tested in the IDV, and the error message has nothing to do 
with the isNaN(a) function. Please provide detail information of how this 
funciton been called.



Yuan
> address@hidden> wrote:
> 
 
> >
> > Ok, my bad.
> >
> > Here is a real working example:
> >
> > from java.lang import Double
> >
> > def example_py(val):
> >     if not isNaN(val):
> >       val = val * 2
> >     return val
> >
> > def isNaN(a):
> >     return Double.isNaN(a)
> >
> >
> > Yuan
> > >
 

Ticket Details
===================
Ticket ID: BWP-558582
Department: Support IDV
Priority: Normal
Status: Open