[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20050302: IDV program (cont.)
- Subject: 20050302: IDV program (cont.)
- Date: Wed, 02 Mar 2005 10:32:13 -0700
Hi Valentijn,
Thanks for the quick respons. Could you tell us how we can extract the
LATLON for each pixel using Jython?
Yes, past the following jython routine into your IDV user jython library
(Menu: Edit->Formulas->Jython Libraries)
def processImage (d):
domain = d.getDomainSet()
cs = domain.getCoordinateSystem()
len = domain.getLength()
#Pass in 0 as false so we don't copy the values
rangeValues = d.getFloats(0)
samples = domain.getSamples(0)
latlon = cs.toReference(samples)
print "len=",len
for i in xrange(len):
value = rangeValues[0][i]
lat = latlon[0][i]
lon = latlon[1][i]
This gets the latlon values of the spatial domain and the image values
and iterates through them.
To use this make a formula (Menu: Edit->Formulas->Create Formula)
The name can be anything. the Fomula: needs to call the above procedure
processImage(theImage)
Now, you should have the formula show up in the Data Selector window.
Now, load in some satellite imagery. Right click on the formula. You
should see
a popup menu. One of the items is "Evaluate Formula". Select that.
You will be prompted to select the value for the "theImage" parameter.
Select *one time* from imagery. Do not select the "All Times" field
since the
processImage routine is expecting one time.
If you want to visualize the results of some processing we'll leave that
to another day.
(Basically, the above routine needs to create a new image data set and
return it).
-Jeff