Re: interpolation for resizing [message #64163 is a reply to message #64162] |
Tue, 02 December 2008 20:04   |
Chris[6]
Messages: 84 Registered: July 2008
|
Member |
|
|
On Dec 2, 1:28 pm, David Fanning <n...@dfanning.com> wrote:
> bryan.s.h...@gmail.com writes:
>> I have a 100 X 100 spatial image to be resized to 1000*1000.
>> The data of this image is surface temperature and includes some part
>> of ocean.
>> Because I want to exclude data of ocean area during interpolation, I'm
>> trying to resize it using "interpolate".
>> But I cannot understand the IDL help pages for the 'interpolate'.
>> Could anyone help me with a simple command line for this job?
>
> I don't think this is what you want to do.
> Just use CONGRID (or REBIN) to resize your
> image. (CONGRID uses INTERPOLATE to do the
> interpolation, so you can see how it is done,
> if you read the code.) Then mask out your ocean
> pixels in the usual way, with the WHERE function.
>
> bigImage = Congrid(image, 1000, 1000)
> oceanPixels = Where(bigimage EQ 9999, count)
> IF count GT 0 THEN image[oceanPixels] = 0
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Coyote's Guide to IDL Programming (www.dfanning.com)
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
One potential issue with this approach is that IDL may interpolate
between your 9999 values and your real data values when you expand the
array. If you set the 9999s to !values.f_nan beforehand, then the
interpolation will behave more sensibly.
chris
|
|
|