[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[IDV #ROS-547661]: Assigning new unit problem
- Subject: [IDV #ROS-547661]: Assigning new unit problem
- Date: Tue, 02 Aug 2011 14:46:56 -0600
Mathew,
The problem is that Jython/VisAD is not smart to handle the units in this case.
Therefore you have to "help" it. Here is something to get you going:
def Temperature(T,P,PH):
"""Calculate temperature from T, P, PB"""
P0 = 100000
t = noUnit(T)
p = noUnit(P)
ph = noUnit(PH)
pt = (t+300)*(((p+ph)/P0)**.2854)
pt = newUnit(pt,"pt","K")
return pt
Best Regards,
-Unidata IDV Support
> Full Name: Matthew King
> Email Address: address@hidden
> Organization: Millersville University Earth Science
> Package Version: 2.9u1 build date:2010-09-02 19:36 UTC
> Operating System: Linux
> Hardware: Java: home: /home/users/wrfchem/IDV_2.9u1/jre version: 1.6.0_20
> j3d:1.5.2 fcs (build4)
> Description of problem: Hello,
>
> I am attempting to create a temperature profile from perturbation
> temperature, perturbation pressure, and basestate pressure. One of the
> issue's I was running into earlier was that the constant that is used in the
> denominator needs to have a unit assigned to it, and this is where the error
> seems to be coming from. The Python code block is written out as such:
>
> def Temperature(T,P,PH):
> """Calculate temperature from T, P, PB"""
> P0 = 100000
> P0 = newUnit(P0,"P0","Pa") # get P0 into same unit as P and PB
> pt = (T+300)*(((P+PH)/P0)**.2854)
> return pt
> With T=perturbation temperature(K), P=perturbation pressure(Pa), PB=base
> state pressure(Pa), pt= profile temperature(K) and P0=constant(Pa).
>
> I have tried various ways of setting the units for both the constant and the
> final output. I have also looked over your online workshops as a way to gauge
> what is wrong and even then I still have this problem.
>
> Any solutions would be greatly appreciated.
>
> Matthew King
>
> Creating display: Contour Plan View
> TypeError: setParamType(): 1st arg can't be coerced to visad.FieldImpl
> org.python.core.PyException
>
> Traceback (innermost last):
> File "<string>", line 1, in ?
> File "<string>", line 5, in Temperature
> File "<string>", line 152, in newUnit
> TypeError: setParamType(): 1st arg can't be coerced to visad.FieldImpl
>
> ******************
> Stack trace:
> Traceback (innermost last):
> File "<string>", line 1, in ?
> File "<string>", line 5, in Temperature
> File "<string>", line 152, in newUnit
> TypeError: setParamType(): 1st arg can't be coerced to visad.FieldImpl
>
>
>
Ticket Details
===================
Ticket ID: ROS-547661
Department: Support IDV
Priority: Normal
Status: Closed