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

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

Using

log(max_data(field,.00001))/2.302585092994

worked like a charm, first time!

Thanks,

-Rich

(BTW, "field" could be replaced by anything that isn't a recognized
function.  It's just the name that appears in IDV, and you then have
to click to associate a particular variable.)


On 9/11/07, Tom Whittaker <whittaker@xxxxxxxx> wrote:
> Rich:
>
> 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:
> <http://www.ssec.wisc.edu/~dglo/visad/visad/python/JPythonMethods.html>
>
> There is a plain text "quick reference" in the first part of the file at:
> <http://www.ssec.wisc.edu/~tomw/visadtutor/cheatsheet.txt>
>
> 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
> log(field)/log(10).
>
>
> > 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
>
> --
> 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
>


-- 
Dr. Richard P. Signell   (508) 457-2229
USGS, 384 Woods Hole Rd.
Woods Hole, MA 02543-1598