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

Hi

Thank you very much for the advice. I have edited the portion what gave the 
error by adding "make2D(item)"& i now get a result. The unit is also correct 
(m²/s²)

Now I would like to ask you one last question on this jython code. perhaps you 
can help me with this one too.

The original formula calculates the Storm relative helicity of a normal storm 
motion
umotion = 0.75 * umean
vmotion = 0.75 * vmean

I would now like to do the same jython, but applied to the deviant storm motion 
of a right moving supercel.
the formula to calculate the deviant storm motion (u & v component) is this one:

umotion=((umean+(7.5/(shear))*vshear))
vmotion=((vmean-(7.5/(shear))*ushear))

so plugged in the full jython it looks like this:

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+(7.5/(shear))*vshear))    <= Problem resides here: "unit 
exception"
 vmotion=((vmean-(7.5/(shear))*ushear))    <= Problem resides here: "unit 
exception"
 ******************************************************

 
srh1=((make2D(u950)-make2D(umotion))*(make2D(v1000)-make2D(vmotion))-(make2D(u1000)-make2D(umotion))*(make2D(v950)-make2D(vmotion)))
 
srh2=((make2D(u900)-make2D(umotion))*(make2D(v950)-make2D(vmotion))-(make2D(u950)-make2D(umotion))*(make2D(v900)-make2D(vmotion)))
 
srh3=((make2D(u850)-make2D(umotion))*(make2D(v900)-make2D(vmotion))-(make2D(u900)-make2D(umotion))*(make2D(v850)-make2D(vmotion)))
 
srh4=((make2D(u800)-make2D(umotion))*(make2D(v850)-make2D(vmotion))-(make2D(u850)-make2D(umotion))*(make2D(v800)-make2D(vmotion)))
 
srh5=((make2D(u750)-make2D(umotion))*(make2D(v800)-make2D(vmotion))-(make2D(u800)-make2D(umotion))*(make2D(v750)-make2D(vmotion)))
 
srh6=((make2D(u700)-make2D(umotion))*(make2D(v750)-make2D(vmotion))-(make2D(u750)-make2D(umotion))*(make2D(v700)-make2D(vmotion)))

 sreh = srh1 + srh2 + srh3 + srh4 + srh5 + srh6

 return sreh

When I run this jython code, the IDV gives me a "unit exception" error (no 
further information). 

I tried to insert a "noUnit(shear)" or "noUnit(vshear)" but none of these 
options work because when plugging in a noUnit() the IDV gives me the error 
message "FlatField: RangeUnits must be convertable with RangeType default 
Units".

As you have helped me with the first question, can you provide an explanation 
as to why this piece of jython doesn't work? or maybe edit the 2 lines or point 
me in the right direction?

The whole purpose of these 2 forumulas (helicity of normal storm motion & 
helicity of deviant storm motion) is to compare the 2 quantitatively for a talk 
about supercels & severe weather. I would like to create the 2 maps & lay them 
next to eachother for comparison purposes.

Any help is much appreciated.

Dzengiz

----- Oorspronkelijk bericht -----
Van: "Unidata IDV Support" <support-idv@xxxxxxxxxxxxxxxx>
Aan: "dzengiz tafa" <dzengiz.tafa@xxxxxxxxxx>
Cc: support-idv@xxxxxxxxxxxxxxxx
Verzonden: Maandag 13 januari 2014 23:57:56
Onderwerp: [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 idvusers@xxxxxxxxxxxxxxxx list. Sorry I could not be of more help.

Best Wishes,
Unidata IDV Support


> Full Name: Dzengiz Tafa
> Email Address: dzengiz.tafa@xxxxxxxxxx
> 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



  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the idvusers archives: