Re: [idvusers] IDV formula problems: available math functions & debugging?

  • To: "Rich Signell" <rsignell@xxxxxxxx>
  • Subject: Re: [idvusers] IDV formula problems: available math functions & debugging?
  • From: "Tom Whittaker" <whittaker@xxxxxxxx>
  • Date: Tue, 11 Sep 2007 12:42:59 -0500

What is "field"?  If it is a Data object passed into the formula from
a Chooser, then it is most likely a VisAD Field object of some kind.
Normally, you would be using methods defined in that class (or a
subclass thereof); however, we have defined some short-cuts in the
"JPythonMethods" class that you can use more conveniently.

First, you need to import JPythonMethods....but, if you look in the
"System LIbrary" tab on the Jython Libraries editor, you'll see it's
already imported, so you can use the methods directly.

There is a Javadoc for this at:

There is a plain text "quick reference" in the first part of the file at:

Note that the "max" and "min" functions for these data are named
"max_data" and "min_data" --
there was a naming conflict with Jython built-ins...

Also, note there is no log10 function, you'll have to compute it as

> log10(max(field,0.00001))

would then become:   log(max_data(field,.00001))/2.302585092994

> Is there a recommended way of debugging?   (I don't have a clue
> whether my syntax is wrong, the functions don't exist, etc).

In general, the error messages in the console are pretty specific, so
looking there is usually the best way.  Obviously, there are times
when that's not the case!

Hope this helps.


Tom Whittaker
University of Wisconsin-Madison
Space Science & Engineering Center (SSEC)
Cooperative Institute for Meteorological Satellite Studies (CIMSS)
1225 W. Dayton Street
Madison, WI  53706  USA
ph: +1 608 262 2759