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

[IDV #IAA-701481]: barnes on mutiple data sources



Hi Tyn-

> I was getting an error on this line:
> a = extractParameter(a,t)
> 
> Using the attached data sources.
> 
> Any ideas?

Yeah, I need to learn to type.  I kept calling the same function with the
original obs, not the individual timesteps.  The fix will be in the next
successful nightly build.

Also, I had to clean up your jython a bit.  It turns out that mergeData needs
to use fields without time.  Here's a new version:

def myBarnes(fieldSourceOne,fieldSourceTwo,param,user_ouputRes):
  from java.lang import Float, Double, Object
  from ucar.unidata.data.point.PointObFactory import *
  from visad import RealType

  outputRes = Float(user_ouputRes)

  a = fieldSourceOne
  b = fieldSourceTwo
  t = RealType.getRealType(param)
  c = extractParameter(a,t)
  d = extractParameter(b,t)
  field = mergeData([c,d])
  field = makeTimeSequenceOfPointObs(field)
  t = RealType.getRealType(param)
  return barnes(field,t,outputRes,outputRes,2)

However, since you only have 2 points, I'm not sure how much of an analysis you
are going to get.  Using a spacing of .1 really sucked down my machine also.

Don

> Cheers, Tyn
> 
> Full error message:
> 
> Traceback (innermost last):
> File "<string>", line 1, in ?
> File "<string>", line 182, in myBarnes
> java.lang.StackOverflowError  at
> visad.DerivedUnit.sameDimensionality(DerivedUnit.java:701)    at
> visad.DerivedUnit.isConvertible(DerivedUnit.java:1117)        at
> visad.ScaledUnit.isConvertible(ScaledUnit.java:548)   at
> visad.OffsetUnit.isConvertible(OffsetUnit.java:601)   at
> visad.DerivedUnit.isConvertible(DerivedUnit.java:1122)        at
> visad.ScaledUnit.isConvertible(ScaledUnit.java:548)   at
> visad.OffsetUnit.isConvertible(OffsetUnit.java:601)   at
> visad.Unit.canConvert(Unit.java:281)  at
> visad.RealType.equals(RealType.java:313)      at
> ucar.unidata.data.grid.GridUtil.isTimeSequence(GridUtil.java:422)
> at
> ucar.unidata.data.point.PointObFactory.extractParameter(PointObFactory.j
> ava:1362)     at
> ucar.unidata.data.point.PointObFactory.extractParameter(PointObFactory.j
> ava:1373)     at
> ucar.unidata.data.point.PointObFactory.extractParameter(PointObFactory.j
> ava:1373)     at ...
> ucar.unidata.data.point.PointObFactory.extractParameter(PointObFactory.j
> ava:1373)     at.
> java.lang.StackOverflowError: java.lang.StackOverflowError
> 
> Jython Library:
> 
> ########################################################################
> #################################################
> def myBarnes(fieldSourceOne,fieldSourceTwo,param,user_ouputRes):
> from java.lang import Float, Double, Object
> from ucar.unidata.data.point.PointObFactory import *
> from visad import RealType
> 
> outputRes = Double(user_ouputRes)
> 
> a = fieldSourceOne
> b = fieldSourceTwo
> t = RealType.getRealType(param)
> if (GridUtil.isTimeSequence(fieldSourceOne) == 0):
> a = makeTimeSequenceOfPointObs(fieldSourceOne)
> a = extractParameter(a,t)
> if (GridUtil.isTimeSequence(fieldSourceTwo) == 0):
> b = makeTimeSequenceOfPointObs(fieldSourceTwo)
> b = extractParameter(a,t)
> field = mergeData(a,b)
> t = RealType.getRealType(param)
> return barnes(field,t,outputRes,outputRes,2)
> 
> -----Original Message-----
> From: Unidata IDV Support [mailto:address@hidden]
> Sent: Wednesday, July 23, 2008 1:34 AM
> To: Valentijn Venus
> Cc: address@hidden
> Subject: [IDV #IAA-701481]: barnes on mutiple data sources
> 
> Hi Tyn-
> 
> I added a new method to PointObFactory:
> 
> extractParameter(obs, param)
> 
> where param is the name of the parameter you want to extract
> from the two datasets.  So, you could call that after you
> make the TimeSeries and then merge the single parameter fields:
> 
> def myBarnes(fieldSourceOne,fieldSourceTwo,param):
> from ucar.unidata.data.point.PointObFactory import *
> from visad import RealType
> a = fieldSourceOne
> b = fieldSourceTwo
> t = RealType.getRealType(param)
> if (GridUtil.isTimeSequence(fieldSourceOne) == 0):
> a = makeTimeSequenceOfPointObs(fieldSourceOne)
> a = extractParameter(a,t)
> if (GridUtil.isTimeSequence(fieldSourceTwo) == 0):
> b = makeTimeSequenceOfPointObs(fieldSourceTwo)
> b = extractParameter(a,t)
> field = mergeData(a,b)
> t = RealType.getRealType(param)
> return barnes(field,t,0.1,0.1,2)
> 
> 
> The parameter would have to have the same name in both.  You can
> use either the string name or the realtype as I did above.   Essentially
> the string version just calls the other with
> RealType.getRealType(param).
> 
> Let me know if this doesn't work for you.  It's in last night's build.
> 
> Don
> 
> > -----Original Message-----
> > From: Unidata IDV Support [mailto:address@hidden]
> > Sent: Monday, July 14, 2008 8:48 PM
> > To: Valentijn Venus
> > Cc: address@hidden
> > Subject: [IDV #IAA-701481]: barnes on mutiple data sources
> >
> > Hi Tyn-
> >
> > > Full Name: Valentijn Venus
> > > Email Address: address@hidden
> > > Organization: ITC
> > > Package Version: 2.6a2 build date:2008-07-14 07:06 UTC Operating
> > > System: Windows XP
> > > Hardware: Java: home: C:\Program Files\Java\jre1.7.0 version:
> 1.7.0-ea
> >
> > > j3d:1.3.2 fcs (build12) Description of problem: Hi Jeff-
> > >
> > > can u help me preparing a barnes jython function that can use both
> the
> >
> > > METAR and the SYNOPTIC ADDE point data server simultanous?
> > >
> > > Is this the rigth funtion to use?
> > >
> > >
> https://www.unidata.ucar.edu/software/idv/docs/javadoc/ucar/unidata/da
> > > ta/point/PointObFactory.html#mergeData(java.util.List)
> >
> > Theoretically, yes.  However, the two datasets have different
> parameters
> > and the mergeData function assumes each field to have the same
> > parameters.  At this point, there's no easy way to extract out one
> > parameter from the time sequences.
> >
> > Looking at the current code, it's not an easy fix to be able to do it
> at
> > the barnes level.  I've got to do some work on this over the next few
> > months.
> > I'll look into allowing one to merge datasets.
> >
> > Don
> >
> > > def myBarnes(fieldSourceOne,fieldSourceTwo,param):
> > > from ucar.unidata.data.point.PointObFactory import * from visad
> import
> >
> > > RealType a = fieldSourceOne b = fieldSourceTwo if
> > > (GridUtil.isTimeSequence(fieldSourceOne) == 0):
> > > a = makeTimeSequenceOfPointObs(fieldSourceOne)
> > > if (GridUtil.isTimeSequence(fieldSourceTwo) == 0):
> > > b = makeTimeSequenceOfPointObs(fieldSourceTwo)
> > > field = mergeData(a,b)
> > > t = RealType.getRealType(param)
> > > return barnes(field,t,0.1,0.1,2)
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: IAA-701481
> > Department: Support IDV
> > Priority: Normal
> > Status: Open
> >
> > International Institute for Geo-Information Science and Earth
> Observation (ITC)
> > Chamber of Commerce: 410 27 560
> >
> > E-mail disclaimer
> > The information in this e-mail, including any attachments, is intended
> for the addressee only. If you are not the intended recipient, you are
> hereby notified that any disclosure, copying, distribution or action in
> relation to the content of this information is strictly prohibited. If
> you have received this e-mail by mistake, please delete the message and
> any attachment and inform the sender by return e-mail. ITC accepts no
> liability for any error or omission in the message content or for damage
> of any kind that may arise as a result of e-mail transmission.
> >
> >
> 
> 
> Ticket Details
> ===================
> Ticket ID: IAA-701481
> Department: Support IDV
> Priority: Normal
> Status: Open
> 
> 
> International Institute for Geo-Information Science and Earth Observation 
> (ITC)
> Chamber of Commerce: 410 27 560
> 
> E-mail disclaimer
> The information in this e-mail, including any attachments, is intended for 
> the addressee only. If you are not the intended recipient, you are hereby 
> notified that any disclosure, copying, distribution or action in relation to 
> the content of this information is strictly prohibited. If you have received 
> this e-mail by mistake, please delete the message and any attachment and 
> inform the sender by return e-mail. ITC accepts no liability for any error or 
> omission in the message content or for damage of any kind that may arise as a 
> result of e-mail transmission.
> 
> 


Ticket Details
===================
Ticket ID: IAA-701481
Department: Support IDV
Priority: Normal
Status: Open