This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Dave, The problem is that Math.exp expects a numeric type of double, but somehow the IDV/Jython is providing a float (I guess). I have been trying for the last hour to try to convert 17.67*t/(t+243.5) calculation to a double but I am unable to. You may wish to ask address@hidden because I am out of ideas. Best Wishes, Unidata IDV Support > Full Name: dave > Email Address: address@hidden > Organization: china, NMC > Package Version: 5.0 build date:2014-01-18 08:05 UTC > Operating System: Windows 7 > Hardware: Java: home: C:\Program Files\IDV_5.0\jre version: 1.6.0_43 > j3d:1.5.2 fcs (build4) > Description of problem: Hi, > I write a jython function to calculate relative humidity, like this: > > def bolton(t): > """Estimates the saturation vapour pressure in hPa at a given temperature, > T, in celcius""" > # return saturation vapour pressure at a given temperature in celcius > es = 6.112*Math.exp(17.67*t/(t+243.5)) > return es > > def tdew2rh(tdew, t): > """Calculate relative humidity from temperature and dew/frostpoint, > tdew and t, in kelvin. > writed by daikan, 2014/1/31. > """ > return bolton(tdew-273.15)/bolton(t-273.15)*100.0 > > but when I run this function, I get the errors: > > Creating display: Contour Plan View > TypeError: exp(): 1st arg can't be coerced to double > org.python.core.PyException > > So, how can I solve this? Thanks! > Dave > > Ticket Details =================== Ticket ID: VNQ-937112 Department: Support IDV Priority: Normal Status: Closed