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.
Hi Simon- Finally getting back to you on this one. > Full Name: Simon Metcalf > Email Address: address@hidden > Organization: NSW Rural Fire Service > Package Version: 2.7u2 build date:2009-08-26 16:33 UTC > Operating System: Windows XP > Hardware: Java: home: C:\Program Files\IDV_2.7u2\jre version: 1.6.0_13 > j3d:1.5.2 fcs (build4) > Description of problem: Dear team, > > I've been unable to get IDV to accept a formulaic expression of Forest Fire > Danger Index; which is as follows: > > 0.5 + 2.0 * exp(-0.450 + log(DF) - (0.0345 * rh) + (0.0338 * (temp - 273)) + > (0.0234 * (3.6 * u10)) ); > The main problem is that the IDV adheres to unit integrity so you can't create a new physically meaningful unit by subtracting a % from a Kelvin. > There appear to be a couple of problems. Firstly, IDV is not accepting > log(DF), which is supposed to be the natural logarithm of DF. I didn't get the log to fail. For the other problem, I added a noUnit Jython procedure to the nightly build: def noUnit(field): """ remove the units from a grid """ import visad from visad import CommonUnit newunit = CommonUnit.promiscuous rt = GridUtil.getParamType(field).getRealComponents()[0] newType = Util.makeRealType(rt.getName(), visad.CommonUnit.promiscuous) return GridUtil.setParamType(field, newType,0) so, you can change your formula to be: 0.5 + 2.0 * exp(-0.450 + noUnit(log(DF)) - (0.0345 * noUnit(rh)) + (0.0338 * (noUnit(temp) - 273)) + (0.0234 * (3.6 * noUnit(u10))) ); > If I remove log(DF) from the expression and replace it with a default value, > the expression seems to work to the point that it calculates the grids but > then it falls down before displaying the result with a rather unhelpful and > longwinded error log as follows: > ________________ > 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) > __________ > > The error log when using log(DF) is as follows: > _________ > Traceback (innermost last): > File "<string>", line 1, in ? > TypeError: log(): 1st arg can't be coerced to visad.Data > _____________ > > Can you provide some assistance in identifying the problem and guidance to > help me get this expression to work in IDV? Unfortunately, I've had similar > problems getting other expressions like Haines Index to work also. > > ****************** > 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: NHB-806382 Department: Support IDV Priority: Critical Status: Open