Re: [idvusers] What is the best way to iterate over a 3d grid using Jython?

  • To: Paul Graham <meteorpaul@xxxxxxxxx>
  • Subject: Re: [idvusers] What is the best way to iterate over a 3d grid using Jython?
  • From: Tom Whittaker <whittaker@xxxxxxxx>
  • Date: Mon, 09 Dec 2013 08:12:38 -0600
Hi Paul --

If your function has no logic that needs to be applied to each point,
then if the data were read in via the IDV they would be "VisAD Data
objects" and you should just be able to do something like:

a = b + c - d

where "b", "c" and "d" are 3D Data objects (or maybe 4D if they
include "time") and it will do the computation on every point. and put
the result in "a" (creating a new Data object with characteristics
like that of "b" (the first object in the computation).

If you have logic, then you might have to iterate over every point...I
say "might" because sometimes some of the built-in methods like "mask"
can be used to simulate logic.

Hope that helps.

tom



On Sun, Dec 8, 2013 at 9:39 PM, Paul Graham <meteorpaul@xxxxxxxxx> wrote:
> Hi IDV'ers,
>
> I have written a Jython function which takes temperature, dewpoint and
> pressure as arguments and evaluated at each point in a 3d domain to
> calculate the wet bulb temperature.  What is the best way using Jython to
> iterate over my domain so I can set the wetbulb result for each point?
> Eg. wetbulbresult[i][j][k] =
> findwetbulb(temperature[i][j][k],dewpoint[i][j][k],pressure[i][j][k]),
> where i,j are subscripts for the latitude and longitude and k for the
> height.
>
> Thanks in advance,
>
> Paul
> _______________________________________________
> idvusers mailing list
> idvusers@xxxxxxxxxxxxxxxx
> For list information, to unsubscribe, visit: 
> http://www.unidata.ucar.edu/mailing_lists/



-- 
Tom Whittaker
University of Wisconsin-Madison
Space Science & Engineering Center (SSEC)
Cooperative Institute for Meteorological Satellite Studies (CIMSS)
1225 W. Dayton Street
Madison, WI  53706  USA
ph: +1 608 262 2759