[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20041029: IDV - jython method for adding dataset



>From: "John Cartwright" <address@hidden>
>Organization: NOAA/NGDC
>Keywords: 200410292302.i9TN2tWI015323 IDV formula data

Hi John-

>Institution: NOAA
>Package Version: 1.1
>Operating System: Win2K sp4
>Hardware Information: Dell Optiplex GX260
>Inquiry: Hello,
>
>I'm trying to use a jython formula to create a new dataset.
>
>However, the display is never generated, visad just keeps processing. In the D
> ata Selector, I choose the formula, then click "Create Display"
>
>Here's the formula:
>===============================
>import math
>
>def generateTestField():
>   z = []
>   for i in range(0,32):
>      a = []
>      for j in range(0,32):
>        a.append( math.sin(i*j*.0174533))
>      z.append(a)
>   f = field(z)
>   return f
>================================
>
>
>Can you show me what I'm doing wrong?

I tried this under 1_1 and using the latest development version.
Since you are not providing lat/lon values for the field, the only
display that this would be meaningful for would be the Omni display.
In both versions, I was able to use that control do display the
image.  Also, if I tried something like a plan view contour, I
got the control, but nothing would be displayed since there are
no lat/lon values.  However, I did not get it just crunching away.
If that's what you got, let me know:

1) what did you provide for the name, formula and description 
fields for the formula?  It should be something like:

Name: test
Formula: generateTestField()
Descriptions: John's way cool formulas (options, will use the name
field as the default).

If you can get past that, here are some more suggestions:

If you change the jython to call the field function to:

   f = field("Longitude", "Latitude", "values", z)

you could display it over Africa. ;-)

To place it somewhere else, use the combination of one of the
JPythonMethods.makeDomain methods and the field method that
takes a set.

Don Murray
NOTE: All email exchanges with Unidata User Support are recorded in the
Unidata inquiry tracking system and then made publicly available
through the web.  If you do not want to have your interactions made
available in this way, you must let us know in each email you send to us.