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

[IDV #XXB-920520]: formula: Storm relative helicity



Dzengiz,

I spent a while studying your Jython. The error occurs in the last few lines 
when calculating srh1 through srh6. As far as I can tell, the script is trying 
to do operations on incompatible types (2D versus 3D grids???). You can confirm 
this (perhaps) by printing out some variables (e.g., u950 and umotion). See 
what "FieldImpl" says. I am out of ideas on how to tackle this problem. Yuan is 
in China this week, so I'll ask Monday. Alternatively, you may wish to ask on 
the address@hidden list. Sorry I could not be of more help.

Best Wishes,
Unidata IDV Support


> Full Name: Dzengiz Tafa
> Email Address: address@hidden
> Organization: Fastowarn
> Package Version: 4.1 build date:2013-08-02 18:38 UTC
> Operating System: Windows 7
> Hardware: Java: home: C:\Program Files\IDV_4.1\jre version: 1.6.0_43 
> j3d:1.5.2 fcs (build4)
> Description of problem: Hi
> 
> I am trying a formula which calculates the storm relative helicity between 
> 1000 & 700mb, using the folowing code:
> 
> def srh3km(u, v, top, bottom, unit=None):
> u1000=getSliceAtLevel(u, 100000)
> u950=getSliceAtLevel(u, 95000)
> u900=getSliceAtLevel(u, 90000)
> u850=getSliceAtLevel(u, 85000)
> u800=getSliceAtLevel(u, 80000)
> u750=getSliceAtLevel(u, 75000)
> u700=getSliceAtLevel(u, 70000)
> v1000=getSliceAtLevel(v, 100000)
> v950=getSliceAtLevel(v, 95000)
> v900=getSliceAtLevel(v, 90000)
> v850=getSliceAtLevel(v, 85000)
> v800=getSliceAtLevel(v, 80000)
> v750=getSliceAtLevel(v, 75000)
> v700=getSliceAtLevel(v, 70000)
> 
> umean=layerAverage(u, bottom, top, unit)
> vmean=layerAverage(v, bottom, top, unit)
> 
> ushear=layerDiff(u, 50000, 100000, unit)
> vshear=layerDiff(v, 50000, 100000, unit)
> 
> shear=sqrt(ushear*ushear+vshear*vshear)
> 
> umotion=umean*0.75
> vmotion=vmean*0.75
> 
> srh1=((u950-umotion)*(v1000-vmotion)-(u1000-umotion)*(v950-vmotion))
> srh2=((u900-umotion)*(v950-vmotion)-(u950-umotion)*(v900-vmotion))
> srh3=((u850-umotion)*(v900-vmotion)-(u900-umotion)*(v850-vmotion))
> srh4=((u800-umotion)*(v850-vmotion)-(u850-umotion)*(v800-vmotion))
> srh5=((u750-umotion)*(v800-vmotion)-(u800-umotion)*(v750-vmotion))
> srh6=((u700-umotion)*(v750-vmotion)-(u750-umotion)*(v700-vmotion))
> 
> sreh=srh1+srh2+srh3+srh4+srh5+srh6
> 
> return sreh
> 
> --
> 
> When trying this formula I get the following error message:
> Creating display: Color-Filled Contour Plan View
> visad.TypeException: visad.TypeException: FunctionType.binary: types don't 
> match
> FunctionType.binary: types don't match
> 
> I need the SREH to work before I can implement the Supercel composite 
> parameter and significant tornado parameter, since they both contain the SREH 
> parameter.
> 
> I really don't know what I am doing wrong, since the formula should work. Is 
> it possible to correct the code or explain what I am doing wrong? Ive been 
> trying for days now (to no avail). I have based this formula on the one found 
> on this url (grads)
> 
> http://www.saakeskus.fi/grads-scripts/63-storm-relative-helicity-0-3km
> 
> Any help is much appreciated.
> 
> Best regards,
> Dzengiz
> 
> ******************
> Stack trace:
> visad.TypeException: FunctionType.binary: types don't match
> at visad.FunctionType.binary(FunctionType.java:283)
> at visad.DataImpl.binary(DataImpl.java:138)
> at visad.DataImpl.subtract(DataImpl.java:192)
> at visad.DataImpl.__sub__(DataImpl.java:1400)
> 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:404)
> at org.python.core.PyObject.__call__(PyObject.java:408)
> at org.python.core.PyMethod.__call__(PyMethod.java:124)
> at org.python.core.PyMethod.__call__(PyMethod.java:115)
> at org.python.core.PyObjectDerived.__sub__(PyObjectDerived.java:187)
> at org.python.core.PyObject._basic_sub(PyObject.java:2119)
> at org.python.core.PyObject._sub(PyObject.java:2105)
> at org.python.pycode._pyx199.srh3km$7(<string>:70)
> at org.python.pycode._pyx199.call_function(<string>)
> at org.python.core.PyTableCode.call(PyTableCode.java:165)
> at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
> at org.python.core.PyBaseCode.call(PyBaseCode.java:174)
> at org.python.core.PyFunction.__call__(PyFunction.java:350)
> at org.python.pycode._pyx200.f$0(<string>:1)
> at org.python.pycode._pyx200.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: XXB-920520
Department: Support IDV
Priority: Normal
Status: Open