Re: [idvusers] pressure grid

Hi Joleen-

extractPressureFromNWPGrid just calls DerivedGridFactory.createPressureGridFromDomain. Looking at the code there, I think your grid should be handled okay. What kind of error do you get? You can send that to me off line.

Don


On 12/10/13 7:19 AM, Joleen Feltz wrote:
Hi,

This question might be out of place, but I have been wondering for a long time 
how to create a cross section of potential temperature based off a satellite 
generated temperature and humidity retrieval.  I have been able to create a 
single level flat field, but never a cross section.  It seems to me that this 
is the approach I want to take.  However, the field that I have does not appear 
to be a proper flat field for the extractPressureFromNWPGrid function.  What 
are the requirements?  The field as far as I know is T(lon,lat,P):

VisAD MathType analysis
   FunctionType:
   Domain has 3 components:
    0. RealType: longi[unit:degrees_east]
    0.   Name = longi[unit:degrees_east]
    0.   Unit: degrees_east
    1. RealType: lati[unit:degrees_north]
    1.   Name = lati[unit:degrees_north]
    1.   Unit: degrees_north
    2. RealType: Plevs[unit:hPa]
    2.   Name = Plevs[unit:hPa]
    2.   Unit: hPa
   Range:
     RealType: TAir[unit:K]
       Name = TAir[unit:K]
       Unit: K

Thanks for your help,
Joleen

On Dec 9, 2013, at 3:59 PM, Paul Graham wrote:

Hi Tom,

Thanks for your help.  I figured out a method after some experimentation
and realised I could not use the visad logic.  My algorithm works
point-wise, which requires having to step through each point individually.
Essentially, I modified existing code for substitution, found in IDV's
Jython library:

def wetbulb(temp,dewpt):
   from java.lang import Math
   tempData = temp.clone();
   dewptData = dewpt.clone();
   presData = extractPressureFromNWPGrid(tempData);
   wetbulbData = temp.clone();
   if (GridUtil.isTimeSequence(tempData)):
      for t in range(tempData.getDomainSet().getLength()):
         tempValues = tempData[t]
         dewptValues = dewptData[t]
         presValues = presData[t]
         wetbulbRangeObj = wetbulbData.getSample(t)
         newValues = wetbulbRangeObj.getFloats(0)
         print "Processing wetbulb temperature for time ", t
         for i in range(len(tempValues)):
            if(str(float(tempValues[i].getValue()))!='nan'):
               newValues[0][i] =
findwetbulb(kelvinToCelcius(tempValues[i].getValue()),kelvinToCelcius(dewptValues[i].getValue()),presData[i].getValue())
         wetbulbRangeObj.setSamples(newValues,1)
   wetbulbData = newUnit(noUnit(wetbulbData),'Wetbulb temperature in
celcius','C')
   return wetbulbData


Paul



On 10 December 2013 01:12, Tom Whittaker <whittaker@xxxxxxxx> wrote:

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

_______________________________________________
idvusers mailing list
idvusers@xxxxxxxxxxxxxxxx
For list information, to unsubscribe, visit: 
http://www.unidata.ucar.edu/mailing_lists/

_______________________________________________
idvusers mailing list
idvusers@xxxxxxxxxxxxxxxx
For list information, to unsubscribe, visit: 
http://www.unidata.ucar.edu/mailing_lists/


--
Don Murray
NOAA/ESRL/PSD and CIRES
303-497-3596
http://www.esrl.noaa.gov/psd/people/don.murray/