comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Working with 2 partially overlapping images of different array sizes
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Working with 2 partially overlapping images of different array sizes [message #28835] Tue, 15 January 2002 12:19 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
aqueous0123@yahoo.com (aqueous) writes:

> Craig Markwardt <craigmnet@cow.physics.wisc.edu> wrote in message news:<on8zb4gtao.fsf@cow.physics.wisc.edu>...
>>
>> What you are asking for is 100% what the function INTERPOLATE() will
>> do for you. The only trick is to make the X and Y arrays for the
>> interpolation. You are trying to interpolate IMAGE2 onto the grid for
>> IMAGE1, so what you want is an array of X values and Y values that
>> express the IMAGE1 grid in the coordinate system of IMAGE2.
>>
>> ;; Length of image 2 in the X and Y directions
>> lenx2 = max(lons2)-min(lons2) & leny2 = max(lats2)-min(lats2)
>> ;; Pixel sizes of each image
>> dx2 = lenx2/n_elements(lons2) & dy2 = leny2/n_elements(lats2)
>>
>> x1 = (lons1-lons2(0))/dx2
>> y1 = (lats1-lats2(0))/dy2
>>
>> image3 = interpolate(image2, x1, y1, /grid)
>>
>> Based on what you said, you definitely don't want to use MISSING,
>> because you want nearest neighbor on the outskirts where IMAGE2 is not
>> defined. [ If you really wanted to set to zero then you would say,
>> MISSING=0. ]
>>
>> Good luck,
>> Craig
>
> Thanks Craig.
> I implemented your solution into the folowing fn.
>
> function testArrays, $
...
> dx2 = xDelta2 / xSize2
> dy2 = yDelta2 / ySize2

How about this instead?
dx2 = xdelta2 / (xsize2-1)
dy2 = ydelta2 / (ysize2-1)

...
> Huh?

I assume you can be responsible for debugging your own programs. :-)
In this case the place to look is at the values of X1 and Y1, which
should be the pixel values that go into INTERPOLATE. The above change
may solve your problem.

I think you will have to be more careful. Especially regarding
whether pixels are measured on-center, or on-corner. Also, does the
range [2,5] refer to the edges of the pixels or the centers?

Good luck,
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Large TIFF file question
Next Topic: Re: load sharing on multiple machines?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 09:31:46 PDT 2025

Total time taken to generate the page: 1.04023 seconds