Re: [idvusers] idvusers Digest, Vol 59, Issue 2

Glad you got it working.  Recently, Paul Graham posted some code for
computing wet bulb temperature -- you might search the idvusers
archives regarding that.

tom

On Wed, Jan 15, 2014 at 5:32 AM,  <dzengiz.tafa@xxxxxxxxxx> wrote:
> Well I did manage to get it working yesterday. Indeed as you mentioned.
>
> I first stripped the variables of their units & then assigned a unit using 
> the "newUnit(xx,"xx","xx")" method. It worked with the Storm relative 
> helicity formula, but I can't seem to make it work trying to build a formula 
> that calculates the Wetbulb temperature.
>
> When applying the method (stripping units then assigning one) i get the 
> "NullPointer Exception". Still entering my enfant steps into the IDV 
> scripting language though, so I am still not familiar with how it all works.
>
> I managed to do the severe weather formulas I was trying to add (SRH, SCP, 
> STP, EHI, SHIP, BRN)... Hehe seems like i'm craving for more.
>
> Still... Too bad its not as easy as the Grads scripting (you don't have all 
> those unit errors. It easily looks past them). On the other hand... You cant 
> deny the power of the unidata products.
>
> If any1 would like it, I can set you on the right track creating the severe 
> weather parameters mentioned.
>
> Grtz & thanks from a newbie in the unidata idv community.
>
> I appreciate the comments & replies
>
> Dzengiz
>
> ----- Oorspronkelijk bericht -----
> Van: idvusers-request@xxxxxxxxxxxxxxxx
> Aan: idvusers@xxxxxxxxxxxxxxxx
> Verzonden: Dinsdag 14 januari 2014 23:36:26
> Onderwerp: idvusers Digest, Vol 59, Issue 2
>
> Send idvusers mailing list submissions to
>         idvusers@xxxxxxxxxxxxxxxx
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mailman.unidata.ucar.edu/mailman/listinfo/idvusers
> or, via email, send a message with subject or body 'help' to
>         idvusers-request@xxxxxxxxxxxxxxxx
>
> You can reach the person managing the list at
>         idvusers-owner@xxxxxxxxxxxxxxxx
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of idvusers digest..."
>
>
> Today's Topics:
>
>    1. Re: [IDV #XXB-920520]: formula: Storm relative helicity
>       (Brian Mapes)
>    2. Re: [IDV #XXB-920520]: formula: Storm relative helicity
>       (Tom Whittaker)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 14 Jan 2014 20:35:08 +0000
> From: Brian Mapes <bmapes@xxxxxxxxxxxxxxx>
> To: "dzengiz.tafa@xxxxxxxxxx" <dzengiz.tafa@xxxxxxxxxx>
> Cc: "idvusers@xxxxxxxxxxxxxxxx" <idvusers@xxxxxxxxxxxxxxxx>
> Subject: Re: [idvusers] [IDV #XXB-920520]: formula: Storm relative
>         helicity
> Message-ID: <0F7C3BE9-7571-4EFF-826A-1D60DE5E08AD@xxxxxxxxxxxxxxx>
> Content-Type: text/plain; charset="iso-8859-1"
>
> I have no answers.
> More broadly, links to more info on units in IDV in general would be of 
> interest to this reader.
> If list readers have knowledge to share.
>
>
> Sent from my iPad
>
>> On Jan 14, 2014, at 6:33 AM, "dzengiz.tafa@xxxxxxxxxx" 
>> <dzengiz.tafa@xxxxxxxxxx> wrote:
>>
>> 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
>>
>> _______________________________________________
>> idvusers mailing list
>> idvusers@xxxxxxxxxxxxxxxx
>> For list information, to unsubscribe, visit: 
>> http://www.unidata.ucar.edu/mailing_lists/
>
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 14 Jan 2014 16:35:50 -0600
> From: Tom Whittaker <whittaker@xxxxxxxx>
> To: Brian Mapes <bmapes@xxxxxxxxxxxxxxx>
> Cc: "idvusers@xxxxxxxxxxxxxxxx" <idvusers@xxxxxxxxxxxxxxxx>,
>         "dzengiz.tafa@xxxxxxxxxx" <dzengiz.tafa@xxxxxxxxxx>
> Subject: Re: [idvusers] [IDV #XXB-920520]: formula: Storm relative
>         helicity
> Message-ID:
>         <CAA6nkJDT3y+Z8kJKxXmXQdftr2AP5gorM4QbyrBeRFhPpF3mzA@xxxxxxxxxxxxxx>
> Content-Type: text/plain; charset=ISO-8859-1
>
> In the IDV, the underlying data are represented by VisAD Data objects.
>  An attribute of these Data objects is that they may contain units (as
> defined by the udunits package).  When arithmetically combining Data
> objects, the units must be "compatible", just as in any equation.
> Thus, when you add or subtract two Data objects, their units must be
> compatible, and the values are transformed automatically.  For
> example, if you add something with units in degC to something with
> units of degF, the result is "correct" since values were converted to
> degK (as a "common unit") first.
>
> Sometimes, we encounter ad-hoc formulas that need to combine just the
> numeric values, without regards to units.  The classic example for me
> is "wind chill", but as we know there are others ;-)
>
> In the IDV, one can either strip the units from the Data object prior
> to combining, or extract the numeric values and work with them.
> Since the units of a Data object are immutable (they cannot be
> arbitrarily changed), it is necessary to create a 2nd object with the
> desired units (or lack of units, in this case).   Sometimes, it is
> more expedient to extract the values and then use some of the JNumeric
> (similar to NumPy) operators to combine the values.  Otherwise, one
> must usually iterate through all the values, which in Jython (Python)
> can be slow.
>
> There are several examples of doing this within the JPythonMethods
> class in the visad.python package.  In addition, several posting on
> the McIDAS-V Forum have provided examples of doing such things.
>
> I hope this helps, and I trust others with more experience will chime in...
>
> tom
> --
> Tom Whittaker
> Madison, WI USA
>
>
> On Tue, Jan 14, 2014 at 2:35 PM, Brian Mapes <bmapes@xxxxxxxxxxxxxxx> wrote:
>> I have no answers.
>> More broadly, links to more info on units in IDV in general would be of 
>> interest to this reader.
>> If list readers have knowledge to share.
>>
>>
>> Sent from my iPad
>>
>>> On Jan 14, 2014, at 6:33 AM, "dzengiz.tafa@xxxxxxxxxx" 
>>> <dzengiz.tafa@xxxxxxxxxx> wrote:
>>>
>>> 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
>>>
>>> _______________________________________________
>>> idvusers mailing list
>>> idvusers@xxxxxxxxxxxxxxxx
>>> For list information, to unsubscribe, visit: 
>>> http://www.unidata.ucar.edu/mailing_lists/
>>
>> _______________________________________________
>> idvusers mailing list
>> idvusers@xxxxxxxxxxxxxxxx
>> For list information, to unsubscribe, visit: 
>> http://www.unidata.ucar.edu/mailing_lists/
>
>
>
> --
> Tom Whittaker
> Madison, WI USA
>
>
>
> ------------------------------
>
> _______________________________________________
> idvusers mailing list
> idvusers@xxxxxxxxxxxxxxxx
> For list information, to unsubscribe, visit: 
> http://www.unidata.ucar.edu/mailing_lists/
>
>
> End of idvusers Digest, Vol 59, Issue 2
> ***************************************
>
> _______________________________________________
> idvusers mailing list
> idvusers@xxxxxxxxxxxxxxxx
> For list information, to unsubscribe, visit: 
> http://www.unidata.ucar.edu/mailing_lists/



-- 
Tom Whittaker
Madison, WI USA



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