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

[IDV #JUN-146918]: jython: return tuple of GRIDded Objects



Hi Tyn-

> Is this doable (return tuple from one jython function)?

It depends what you want to do with the tuple after you get it back.  If you 
are going to pass it off to the display, that will not work.

However, to pass a tuple, you would create an array:

tuple = []
tuple.append(newc)
tuple.append(newd)

and access them as tuple[0] and tuple[1].

What do you want to pass the tuple off to?
 
> Like:
> 
> def averageImages (a,b):
> lineValuesA = a.getFloats()
> lineValuesB = b.getFloats()
> values = zeros(2,"d")
> for i in xrange(a.getDomainSet().getLength()):
> # first fill the array 'values' with values
> values[0] = lineValuesA[0][i]
> values[1] = lineValuesB[0][i]
> mean = Mean()
> max = Max()
> average = mean.evaluate(values)
> maximum = max.evaluate(values)
> lineValuesA[0][i] = average
> lineValuesB[0][i] = maximum
> newc = a.clone()
> newd = b.clone()
> newc.setSamples(lineValuesA)
> newd.setSamples(lineValuesB)
> return mean, max
> 
> it would save a lot of time as my crop growth simulations model now has to 
> run for each output parameter (some 20)...
> 
> Tyn
> 
> -----Original Message-----
> From: Unidata IDV Support [mailto:address@hidden]
> Sent: Friday, February 05, 2010 8:20 AM
> To: Valentijn Venus
> Subject: [IDV #JUN-146918]: jython: return tuple of GRIDded Objects
> 
> 
> address@hidden,
> 
> Your Ticket has been received, and a Unidata staff member will review it and 
> reply accordingly. Listed below are details of this new Ticket. Please make 
> sure the Ticket ID remains in the Subject: line on all correspondence related 
> to this Ticket.
> 
> Ticket ID: JUN-146918
> Subject: jython: return tuple of GRIDded Objects
> Department: Support IDV
> Priority: Normal
> Status: Open
> 
> 
> 
> Please let us know how we can assist you any further.
> 
> Unidata User Support
> 
> Faculty of Geo-Information Science and Earth Observation (ITC)
> University of Twente
> 
> 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: JUN-146918
Department: Support IDV
Priority: Normal
Status: Open