Re: Summing formula

I realized after I hit "Send" that in this case the "getNthTimeGrid()"
is not really needed.  You can simply say:  "  a = g[k] + a ".
Perhaps the former is more illustrative as to what's going on,
however.

tom


On 3/6/07, Tom Whittaker <tomw@xxxxxxxxxxxxx> wrote:
Hi Scott....

The IDV formulas are ideal for this.  If you're not familiar, let me
suggest this.

1. Create a small Jython script in the "User Library"
(Edit->Formulas->Jython LIbrary).  If you're
    no familiar with Python syntax, just note that the number of
spaces (indents) on a line
    are important since they determine the blocks in the code.  Here's
my suggestion:

def addEmUp(g, n):
  a = 0
  for k in range(int(n)):
    a = getNthTimeGrid(g, k) + a
  return a

     Don't forget to "File->Save" the library.

2. Then create a formula to call this.  For example:
         Name = Add times
         Formula =  addEmUp(grid, user_NumbTimes)

     In the "Advanced" section, I would recommend enabling only the
Displays relevant to your data (for example, Controur Plan View).

Then use the Chooser to get pointed to your grids, and in the Field
Selector, pick your formula.  A small window will appear asking you
for the value of "NumbTimes".  Enter a number.  Then you'll be asked
to select from the usual list of grids -- pick the one your interested
in.

By the way, the "getNthTimeGrid()" is a method defined in the "System
Jython library" -- lots of other goodies in there as well!

Hope this gets you going!!

tom


On 3/6/07, Scott.Stephens <Scott.Stephens@xxxxxxxx> wrote:
>
>  Hi,
>
>  Has a sum function been built for IDV? I would like to generate precip
> totals for varying time intervals, (e.g. total model QPF for a model's run
> time, etc), but can't figure out the best way to generate the desired output
> using multiple forecast hours.
>
>  Thanks for your time,
>  Scott
>
>
>
>
>
>
>
>
>
>
>
>
>
>


--
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



--
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



  • 2007 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the idvdevelopers archives: