Re: matching 2 grids [message #47848 is a reply to message #47843] |
Wed, 08 March 2006 17:53   |
Robert Moss
Messages: 74 Registered: February 1996
|
Member |
|
|
Jenny wrote:
> Hi Mark,
>
> Thanks for your reply!
>
> Sorry I'm not very clear about my problem. But it seems more complex
> than the one posted yesterday. They are 2-D arrays. I have 2 files for
> grid1: 600*600 array for lat1, and 600*600 array for lon1, one
> lat1/lon1 pair (smae coordinate in the array) represents the true
> location on earth. So generally lat1 increase along a column, and also
> slightly different along a row. Same for lon1, increase along a row,
> slightly different along a column. I think grid1 was produced from
> polar stereographic projection, so that they are not equally spaced
> lat/lon pairs. grid2 is a polygon shaped subset of grid1, they are also
> one 2-d array for lat2 and one for lon2 (say 100*120 with 0 filled in
> some places), but not exactly the same values as those in grid1, grid2
> was defined in a different projection. What I want is to find the
> closest lat1/lon1 for each of the lat2/lon2 based on the geographic
> location the lat/lon represents.
>
> I'll check the Motley library. I'd appreciate any further insights!
>
> -Jenny
>
This may not be what you are shooting for, but here's my idea: Use grid1
as an IGM to create a GLT for image1. Convert the data in grid2 to
geographic coordinates using ENVI_CONVERT_PROJECTON_COORDINATES if they
are not already. Then use ENVI_CONVERT_FILE_COORDINATES to convert the
new grid2 geographic coordinates into a file location in the grid1 GLT.
From there you can get the exact pixels that were used in grid1 that
correspond to grid2.
This all assumes you need to know the precise coordinates in the
original grid1 file so you can relate them to unaltered raw image data
from which grid1 was derived. If that is not what you are trying to do,
there is almost certainly a simpler way.
Robert Moss, PhD
|
|
|