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

20051018: 20050814: IDV version 1.2 available for download



>From: "Valentijn Venus" <address@hidden>
>Organization: ITC
>Keywords: 200510180834.j9I8YW7s006298 Jython

Hi Valentijn-

>did you get a change to look at the question i send the other day
>related to the time series bug ( see below, i.e. running a bandmath
>jython script on more than one ADDE image)?  =20

I sent a reply to that question on August 16.  I've attached that response to
this message.  If that's not the same problem, let me know.

>The jnlp issue is solved in the meantime....

Glad to hear it.

Here's the reply I sent previously:

> From:      Unidata Support <address@hidden>
> Date:      Tue, 30 Aug 2005 10:07:29 -0600
> Organization: UCAR/Unidata
> 
> >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)

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.