[idvusers] Jython coding a grid formula using more than one data source

I'm wondering if someone with some stronger IDV/Jython knowledge than me
help me with proper Jython coding.

What I have already successfully Jython coded:

"Paintball Plot" of Composite Reflectivity >= 38dbz... Load in 5
consecutive HRRR model runs, create a dataSelection subsetting to a user
input domain applied to all 5 sources, creating a field of "Composite
Reflectivity" of all 5 sources, creating the display, applying Display
Control modifications like contour info, display label, etc.  Here is the
code:

def makeHRRR_PaintballPlot_CZ():
> runHour = raw_input('Input last model run hour for the paintball plot: ')
> subset = getPlotSubset()
> boundBox = subset.split(',')
> dataSel = DataSelection()
> colors = ["Red","Orange","Yellow","Green","DkGreen"]
> a = [0,0,0,0,0]
> for x in range(4,-1,-1):
>    a[x] = makeDataSource(getHRRR(int(runHour)-x))
>
>  
> dataSel.setBounds(float(boundBox[0]),float(boundBox[1]),float(boundBox[2]),float(boundBox[3]))
>    field = a[x].getData(a[x].findDataChoice("CompRefl"),None,dataSel,None)
>    dc = createDisplay('planviewcontourfilled',field,"Composite
> Reflectivity")
>    pause()
>    cinfo = idv.getDisplayConventions().findDefaultContourInfo("CompRefl")
>    cinfo.setMin(38.0)
>    dc.setContourInfo(cinfo)
>    ctm = idv.getColorTableManager()
>    dc.setColorTable(ctm.getColorTable(colors[x]))
>    dc.setLegendLabelTemplate("%shortname%")
>    dc.setDisplayListTemplate("%shortname% - %timestamp%")


What I want to do:  After this is done plotting, create another display
that is the average of all 5 of these fields.  I have tried using things
like idveval() and adding all the fields together and dividing by 5, but
that doesn't work (or maybe I'm coding it wrong).  I can make this plot
manually by going into the Dashboard>Field Selector>Formulas and using
idveval() function, but I'd like to have this field automatically created
within this Jython method.  Thanks!

Mike Umscheid


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