Here is one way to do it (maybe). Add this to your Jython library def fire(rhscrn,tscrn,u10): rhscrn = newUnit(rhscrn,"rhscrn","K") tscrn = newUnit(tscrn,"tscrn","K") u10 = newUnit(u10,"u10","K") answer = 2*exp(1.524-0.0345*rhscrn+0.0338*tscrn+0.0234*u10*3.6) return answer The create a formula. See section 4.2.1 of the workshop material. See attached PNG. -Julien > Hi Julien, > > Thanks for the feedback. It seems my assumption that it was an IDV unit > panic were correct. I don't know of a quick way to simply "change" the units > as you suggest within IDV. I could do it by modifying the headers I suppose > but for extremely large data sets (the results are typically about 2 Gb) it > becomes problematic and more trouble than its worth, especially when IDV's > main purpose (for most I think) is a quick way to visualise data. If you do > find a workaround however please let me know. > > Eventually I'll be scripting some animations with NCL graphics and when it > comes to scripting it wouldn't be a problem as you say to simply rename a > unit. I could be wrong but I'm fairly sure NCL and other NetCDF capable > software would continue to process an arithmetic formula even if it didn't > understand the units. It's almost as though a simple "unit panic exception" > needs to be written into IDV so that when it decides "these units are > nonsensical" it thinks "OK, these are the results but I have no idea what the > unit is!" instead of "Oh my I can't deal with this, I need to stop now, > you're on your own!". > > Regards, > > Simon. > > > -----Original Message----- > From: Unidata IDV Support [mailto:address@hidden] > Sent: Wednesday, February 16, 2011 7:18 AM > To: Simon Metcalf > Cc: address@hidden > Subject: [IDV #ZTF-373299]: IDV formula failing, unit problems? > > Hi Simon, > > I can reproduce this problem. I understand that the unit is unitless from the > physics point of view, but the IDV does not see it that way. rhscrn tscrn and > u all have units associated with them which makes the IDV/ViSAD blow up. I am > still looking into a solution / workaround, but that is where I am at. One > way to kludge it, maybe, is to make rhscrn tscrn and u all the same unit, say > temperature. > > -Julien > > > Hi Julien, > > > > I've uploaded the file along with the formula that has the parameter names > > contained in the data so all you have to do is add the formula. The > > formula is not a real variable but a unit-less index that defines the > > relationship between some ground-level prognostics affecting fire danger. > > I assume this is why it's having unit problems but I could be wrong. It > > should be able to produce a result even if it can't identify a sensible > > unit. > > > > 2*exp(1.524-0.0345*rhscrn+0.0338*tscrn+0.0234*u10*3.6) > > > > Only two time steps are included to keep the file size down. > > > > Regards, > > > > Simon. > > > > -----Original Message----- > > From: Unidata IDV Support [mailto:address@hidden] > > Sent: Tuesday, February 15, 2011 3:44 AM > > To: Simon Metcalf > > Cc: address@hidden > > Subject: [IDV #ZTF-373299]: IDV formula failing, unit problems? > > > > Hi Simon. > > > > In order, to better diagnose this problem, would it be possible to > > upload the ccam33S147E08km.nc here: > > http://motherlode.ucar.edu/repository/alias/idvupload > > > > Let us know when it is uploaded. > > > > Also, tell us a bit more about what you are trying to do with these data so > > that we can give you a better answer. > > > > Thanks. > > > > -Julien > > > > > Full Name: Simon Metcalf > > > Email Address: address@hidden > > > Organization: NSW Rural Fire Service Package Version: 2.9u3 build > > > date:2011-01-14 00:05 UTC Operating > > > System: Windows XP > > > Hardware: Java: home: C:\Program Files\IDV_2.9u3\jre version: > > > 1.6.0_20 > > > j3d:1.5.2 fcs (build4) Description of problem: Creating display: > > > Color-Shaded Plan View > > > visad.UnitException: visad.UnitException org.python.core.PyException > > > > > > Hi, I'm having trouble getting IDV to display the following formula: > > > > > > 2*exp(1.524-0.0345*RH+0.0338*T+0.0234*WS*3.6) > > > > > > The error above seems to indicate that it's having trouble identifying a > > > correct unit for the results, which is not surprising because the formula > > > is supposed to create a unit-less index value. Can you assist with > > > identifying the problem with IDV and if there is a workaround solution? > > > > > > Regards, Simon. > > > > > > ****************** > > > Stack trace: > > > Traceback (innermost last): > > > File "<string>", line 1, in ? > > > at visad.RealType.binary(RealType.java:473) > > > > > > at visad.FunctionType.binary(FunctionType.java:270) > > > > > > at visad.FunctionType.binary(FunctionType.java:270) > > > > > > at visad.DataImpl.binary(DataImpl.java:138) > > > > > > at visad.DataImpl.add(DataImpl.java:179) > > > > > > at visad.DataImpl.__add__(DataImpl.java:1393) > > > > > > 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) > > > > > > > > > visad.UnitException: visad.UnitException > > > > > > > > > > > > > > > Ticket Details > > =================== > > Ticket ID: ZTF-373299 > > Department: Support IDV > > Priority: Normal > > Status: Closed > > > > RFS Disclaimer: > > This email message is intended only for the addressee(s) and contains > > information which may be confidential. If you are not the intended > > recipient, please notify the sender and delete this email and any copies or > > links to this email completely and immediately from your system. Views > > expressed in this message are those of the individual sender, and are not > > necessarily the views of the NSW Rural Fire Service. > > > > > Ticket Details > =================== > Ticket ID: ZTF-373299 > Department: Support IDV > Priority: Normal > Status: Open > > Ticket Details =================== Ticket ID: ZTF-373299 Department: Support IDV Priority: Normal Status: Open
Attachment:
fire.png
Description: PNG image