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

20050816: IDV version 1.2 available for download



>From: "Valentijn Venus" <address@hidden>
>Organization: ITC
>Keywords: 200508152235.j7FMZdjo011711  IDV images

Hi Valentijn-

I apologize for the delay in responding.  This took me a bit longer
to figure out than I thought (I'm not the best Jython writer).

>When running the following script on multiple pairs of image (see =
>attached screendump) from adde.ucar.edu dataset: RTIMAGES:=20
>
>def addImages (a,b):
>  lineValuesA =3D a.getFloats()
>  lineValuesB =3D b.getFloats()
>  for i in xrange(a.getDomainSet().getLength()):
>    value =3D lineValuesA[0][i] - lineValuesB[0][i]
>    lineValuesA[0][i] =3D value*i
>  newd =3D a.clone()
>  newd.setSamples(lineValuesA)
>  return newd
>
>I get: "An error has occurred: ControlDescriptor.Creating display
> org.python.core.PyException
>
>
>Traceback (innermost last):
>  File "<string>", line 1, in ?
>  File "<string>", line 8, in addImages
>AttributeError: __getitem__"
>
>This happens with any ADDE dataset, but works fine as long as single =
>images (i.e. one pair) are selected.

The basic problem is that you get two different objects depending on
whether you ask for a set of images or a single image.  When you 
request a sequence of images, the getFloats() end up returning
a null array, thus the error.

So, to handle either case, I wrote the following procedure and call
it:

def addImageSequences(a,b):
  import ucar.unidata.data.grid.GridUtil as gu
  if (gu.isTimeSequence(a)):
     newA = a.clone()
     for t in range(a.getDomainSet().getLength()):
         print "t = ", t
         subA = a.getSample(t)
         subB = b.getSample(t)
         newA.setSample(t,addImages(subA, subB))
     return newA
  else:
     return addImages(a,b)

>
>>>Can we participate as alpha/beta testers?
>>What modifications would you like to do?
>
>>Add some solar and satellitte angle calculation fucntions....

These should be easy to add.  Formulas are defined in derived.xml
and enduserformulas.xml in the /ucar/unidata/idv/resources directory.
You can see there that they can call either Jython procedures or
Java methods.  For hard work, you might want to write some java code,
but a lot of this can be done in Jython.

>>We don't really have a mechanism for sharing code at this point and
>>have to figure out how we could do this most easily.  I'll discuss
>>this with others here and see what we can come up with.=20
>
>Are you developing using Eclipse too?

No. I use vi.

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