ENVI_CONVERT_FILE_COORDINATES returning negative values [message #53958] |
Thu, 10 May 2007 22:00  |
hanneliebx
Messages: 2 Registered: May 2007
|
Junior Member |
|
|
Hi everyone, I'm a new ENVI/IDL user and hope to get some help here
I am attempting to extract 3x3 pixel windows from MODIS images using
lat/long coordinates. To do this I have
-created two variables containing the latitude and longitude of the
area I want to extract
- opened the relevant image file (which has a related .hdr file with
the map info of the image)
- used the command [ENVI_CONVERT_FILE_COORDINATES, fid, XF, YF,
xcoord, ycoord] to change from lat/long coordinates to pixel values
(the xcoord= -35.406368 and ycoord=149.80322, XF and YF output was
-30954 and -34019 respectively)
- used the XF and YF output values to extract the 3x3 pixel window
e.g.
Output[0] = xcoord
Output[1] = ycoord
Output[2] = floor(XF)
Output[3] = floor(YF)
; set the extent of the image you want to extract
dims = [-1, Output[2]-1, Output[2]+1, Output[3]-1, Output[3]+1]
; retrieve the pixels
data = ENVI_GET_DATA(fid=fid, dims=dims, pos=1)
The XF and YF values that are generated are negative and much larger
than the lines and samples of the image (7451x9580), so I am obviously
doing something wrong.
The location is in the Southern hemisphere, so the latitude that I
provided has a negative value (e.g. -35) - I'm sure that is not the
problem though.
Could it be that the header information of the image is not read
properly when the file is opened? Is there a way of displaying the map
info saved in the header when the IDL program is run to check if it is
read correctly? Or am I on the wrong track?
I would really apprecite any pointers.
Hannelie
|
|
|