[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[IDV #PAA-696617]: Error
- Subject: [IDV #PAA-696617]: Error
- Date: Sun, 02 Aug 2015 23:40:04 -0600
JP,
Remember, within the body of this formula you are operating on VisAD types (not
simple numeric values) via operator overloading in Jython. So when you pass your
VisAD object into math.exp, you get the error you reported earlier because
math.exp
has no idea what to do with a VisAD type, it only know about doubles.
You should be able to get around this problem by defining your own math.exp,
something like:
def myexp(field):
return 2.72**field
With the ** operator overloading signifying e to the power of the argument via
'__pow__' method. But when I try this, I get different errors.
Unfortunately, I am out of ideas. You may wish to ask your question on the
address@hidden mailing list. Maybe someone there will know.
Best,
Unidata IDV Support
> I made the changes by turning the 2nd w into mr. However, I am getting this
> error:Creating display: Color-Shaded Plan ViewTypeError: exp(): 1st arg can't
> be coerced to double org.python.core.PyException JP Kalb
>
>
> On Wednesday, July 29, 2015 1:35 PM, Unidata IDV Support <address@hidden>
> wrote:
>
>
> JP,
>
> Right off the bat, there are a few problems with this formula:
>
> - var 'mr' is not defined anywhere as far as I can tell
>
> - var 'w' is reassigned which is confusing; use a different variable name. And
> argument 'vv' does not seem to be used
>
> - var 'd' is assigned but never used
>
> I would suggest cleaning up these problems, and see where you get.
>
> Best,
>
> Unidata IDV Support
>
> > I was trying to use this equation:def cloudht925(gph,temp,rh,vv): import
> > math ht=noUnit(make2D(gph))*3.28 t=noUnit(make2D(temp))
> > hum=noUnit(make2D(rh)) w=noUnit(make2D(vv)) p0=1000.0 cp=1004.67 lv=2257
> > rd=287.05 rv=461.5 es=6.11*math.exp((17.625*(t-273.15))/(t-30.11))
> > e=es*rh/100 w=621.97*e/(925-e) expo=math.exp((lv*w)/(cp*t))
> > num=-1.0*t*((p0**(rd/cp)/(925**(1+(rd/cp))))) denom=(hum/100)**(mr*rv/cp)
> > b=expo*num/denom c=-6.67*b-0.667 d=c*-10*w if c<0: h=12000 elif w>-0.1:
> > h=12000 else: h=ht return h
> > JP Kalb
> >
> >
> >
> > On Tuesday, July 28, 2015 8:58 AM, Unidata IDV Support <address@hidden>
> > wrote:
> >
> >
> > JP,
> >
> > What were you doing when you got this error? It appears you were trying to
> > apply
> > a formula to some RR data. What is that formula?
> >
> > Best,
> >
> > Unidata IDV Support
> >
> >
> > > Full Name: JP Kalb
> > > Email Address: address@hidden
> > > Organization: SJSU/Self
> > > Package Version: 5.1u2 build date:2015-04-27 16:07 UTC
> > > Operating System: Windows 7
> > > Hardware: Java: home: C:\Users\metr166\Documents\IDV_5.1u2\jre version:
> > > 1.7.0_51 j3d:1.6.0-pre9-daily-experimental daily
> > > Description of problem: Hi there,
> > > I got this message as an error
> > > "Creating display: Color-Shaded Plan View
> > > TypeError: exp(): 1st arg can't be coerced to double"
> > > when I was trying my code.
> > >
> > > ******************
> > > Stack trace:
> > > Traceback (most recent call last):
> > > File "<string>", line 1, in <module>
> > > File "<string>", line 13, in cloudht925
> > > TypeError: exp(): 1st arg can't be coerced to double
> > >
> > >
> > >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: PAA-696617
> > Department: Support IDV
> > Priority: Normal
> > Status: Closed
> >
> >
> >
> >
> >
>
>
> Ticket Details
> ===================
> Ticket ID: PAA-696617
> Department: Support IDV
> Priority: Normal
> Status: Closed
>
>
>
>
>
Ticket Details
===================
Ticket ID: PAA-696617
Department: Support IDV
Priority: Normal
Status: Closed