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

[IDV #JBN-701347]: Error when trying exp(field)



> Hi Yuan,
> 
> Thanks for your explanation of my error.  I have found that using the **
> operator seems to work.  So, for example, 2.718**EQPT.  Is this the best
> way to perform something like e^EQPT on the whole 3D grid?  Thanks for your
> help,
> 
> Paul
> 

Paul,
    Again, I will not trust the result of 2.718**EQRT since the EQRT is a visad 
object. You need to verify the result by create the value plot.

I will try to extract the value from EQRT and do the calculation, something 
like:

def expTest(data):
    """change values in data to newvalue """
    newData = data.clone();
    if (GridUtil.isTimeSequence(newData)):
        for t in range(newData.getDomainSet().getLength()):
            rangeObject = newData.getSample(t)
            values = rangeObject.getFloats(0);
            for i in range(len(values)):
               for j in range(len(values[0])):
                           newValue = 2.718**values[i][j];
                           values[i][j] = newValue;                           
            rangeObject.setSamples(values,1);
    else:
        rangeObject = newData;
        values = rangeObject.getFloats(0);
        for i in range(len(values)):
          for j in range(len(values[0])):
             newValue = 2.718**values[i][j];
             values[i][j] = newValue;   
        rangeObject.setSamples(values,1);
    return newData;



This formula has not been tested, you need to do it yourself.

Yuan
> 
> On 17 December 2013 10:07, Unidata IDV Support <address@hidden
> > wrote:
> 
> > > Hi Unidata Support,
> > >
> > > Thanks for getting back to my so promptly.  A test formula I was using is
> > > when this error occurred is:
> > >
> > > def testExp(EQPT):
> > > return exp(noUnit(EQPT.clone()))
> > >
> > > I think the problem has something to do with stripping the units with
> > > noUnit().
> > >
> > > Regards,
> > >
> > > Paul
> >
> > Paul,
> >      The problem is that the input of your formula is a visad object, and
> > Jython can not handle this kind of
> > object. In the IDV, we handle this kind of calculation in Java, extract
> > the numeric value from the visad object and
> > do the calculation, and then construct a new visad object and return to
> > the IDV. But,
> > we don't have exp formula yet.
> >
> >
> > Yuan
> > >
> > >
> > address@hidden
> > > > wrote:
> > >
> > > > > Full Name: Paul Graham
> > > > > Email Address: address@hidden
> > > > > Organization: Weathersim
> > > > > Package Version: 4.1u1 build date:2013-09-25 07:05 UTC
> > > > > Operating System: Linux
> > > > > Hardware: Java: home: /usr/local/bin/IDV_4.1u1/jre version: 1.6.0_41
> > > > j3d:1.5.2 fcs (build4)
> > > > > Description of problem: Not sure as to why the IDV gives this error
> > when
> > > > trying to use the exponential function on a field:
> > > > >
> > > > > Creating display: Color-Filled Contour Plan View
> > > > > visad.UnitException: visad.UnitException: FlatField: RangeUnits must
> > be
> > > > convertable with RangeType default Units
> > > > > FlatField: RangeUnits must be convertable with RangeType default
> > Units
> > > >
> > > > Paul,
> > > >     Could you provide us the formula you were trying?
> > > >
> > > >
> > > > Yuan
> > > > >
> > > > > ******************
> > > > > Stack trace:
> > > > > visad.UnitException: FlatField: RangeUnits must be convertable with
> > > > RangeType default Units
> > > > > at visad.FlatField.<init>(FlatField.java:412)
> > > > > at visad.FlatField.cloneFloat(FlatField.java:5605)
> > > > > at visad.FlatField.unary(FlatField.java:3744)
> > > > > at visad.FieldImpl.unary(FieldImpl.java:906)
> > > > > at visad.DataImpl.unary(DataImpl.java:485)
> > > > > at visad.DataImpl.exp(DataImpl.java:662)
> > > > > at visad.python.JPythonMethods.exp(JPythonMethods.java:942)
> > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> > > > > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > > > > at java.lang.reflect.Method.invoke(Unknown Source)
> > > > > at
> > > >
> > org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
> > > > > 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._pyx283.hailRiskII$15(<string>:240)
> > > > > at org.python.pycode._pyx283.call_function(<string>)
> > > > > at org.python.core.PyTableCode.call(PyTableCode.java:165)
> > > > > at org.python.core.PyBaseCode.call(PyBaseCode.java:149)
> > > > > at org.python.core.PyFunction.__call__(PyFunction.java:327)
> > > > > at org.python.pycode._pyx285.f$0(<string>:1)
> > > > > at org.python.pycode._pyx285.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:787)
> > > > > 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.grid.GridDataInstance.init(GridDataInstance.java:206)
> > > > > at
> > > >
> > ucar.unidata.data.grid.GridDataInstance.<init>(GridDataInstance.java:163)
> > > > > at
> > > >
> > ucar.unidata.data.grid.GridDataInstance.<init>(GridDataInstance.java:144)
> > > > > at
> > > >
> > ucar.unidata.idv.control.GridDisplayControl.doMakeDataInstance(GridDisplayControl.java:284)
> > > > > at
> > > >
> > ucar.unidata.idv.control.DisplayControlImpl.initializeDataInstance(DisplayControlImpl.java:3224)
> > > > > at
> > > >
> > ucar.unidata.idv.control.DisplayControlImpl.setData(DisplayControlImpl.java:3206)
> > > > > at
> > > >
> > ucar.unidata.idv.control.PlanViewControl.setData(PlanViewControl.java:641)
> > > > > at
> > > >
> > ucar.unidata.idv.control.ContourPlanViewControl.setData(ContourPlanViewControl.java:194)
> > > > > at
> > > > ucar.unidata.idv.control.PlanViewControl.init(PlanViewControl.java:471)
> > > > > at
> > > >
> > ucar.unidata.idv.control.DisplayControlImpl.init(DisplayControlImpl.java:1421)
> > > > > at
> > > >
> > ucar.unidata.idv.control.DisplayControlImpl.init(DisplayControlImpl.java:1106)
> > > > > 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:1251)
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > Ticket Details
> > > > ===================
> > > > Ticket ID: JBN-701347
> > > > Department: Support IDV
> > > > Priority: Normal
> > > > Status: Open
> > > >
> > > >
> > >
> > >
> > > --
> > > Paul Graham
> > > Email: address@hidden
> > > Mobile: 0403003784
> > >
> > >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: JBN-701347
> > Department: Support IDV
> > Priority: Normal
> > Status: Closed
> >
> >
> 
> 
> --
> Paul Graham
> Email: address@hidden
> Mobile: 0403003784
> 
> 

Ticket Details
===================
Ticket ID: JBN-701347
Department: Support IDV
Priority: Normal
Status: Closed


NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.