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

[IDV #CNB-926147]: Error in user-made function



> Full Name: Brian Tentinger
> Email Address: address@hidden
> Organization: NWS
> Package Version: 6.2u1 build date:2023-10-02 18:48 UTC
> Operating System: Windows 10
> Hardware: Java: home: C:\Program Files\IDV_6.2u1\jre version: 1.8.0_302 
> j3d:1.6.1 fcs fcs
> Description of problem: Thanks for any help. I'm trying to use this function 
> on a NOAA RAP gridded data set (i.e. from here 
> https://noaa-rap-pds.s3.amazonaws.com/index.html#rap.20240114/)
> Here is the error:
> 
> Creating display: Contour Plan View
> visad.TypeException: visad.TypeException: FunctionType.binary: types don't 
> match
> FunctionType.binary: types don't match
> 
> Here is my function:
> 
> def EPVg(u, v, p, S, top, bottom):
> wind = makeVector(u,v)
> relv = vor(wind)
> absvort = add(relv,corl(relv))
> tgrad = vecr(ddx(S),ddy(S))
> uGradTemp = ur(tgrad)
> vGradTemp = vr(tgrad)
> presDiff = layerDiff(p,top,bottom)
> tempDiff = layerDiff(S,top,bottom)
> uDiff = layerDiff(u,top,bottom)
> vDiff = layerDiff(v,top,bottom)
> dtdx = GridMath.applyFunctionToLevels(uGradTemp, GridMath.FUNC_SUM)
> dtdy = GridMath.applyFunctionToLevels(vGradTemp, GridMath.FUNC_SUM)
> av = GridMath.applyFunctionToLevels(absvort, GridMath.FUNC_SUM)
> epvg = (-0.5*(av*tempDiff+(uDiff*dtdy-vDiff*dtdx))/presDiff)
> return epvg
> 
> ******************
> Stack trace:
Hi Brian,

The Jython is type sensitive, I believe the problem is the line "epvg = ...", 
if so,
you can use the "noUnit(av)" to remove the type in this equation. There is also 
a
"newUnit(field, varname, unitname)" library function you can call to redefine 
the
type of return result.

Yuan

Ticket Details
===================
Ticket ID: CNB-926147
Department: Support IDV
Priority: Normal
Status: Open
===================
NOTE: All email exchanges with NSF 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.