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

Home » Public Forums » archive » Re: 3D congrid without interpolation
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: 3D congrid without interpolation [message #53728 is a reply to message #53405] Mon, 23 April 2007 09:53 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Sat, 14 Apr 2007 10:59:26 -0700, kuyper wrote:

> JD Smith wrote:
>> On Thu, 12 Apr 2007 15:40:07 -0700, mgalloy@gmail.com wrote:
>>
>>> On Apr 12, 3:19 pm, David Fanning <n...@dfanning.com> wrote:
>>>> Humm. Hard for me to imagine what you are using to
>>>> do this that is interpolating anything for you.
>>>> CONGRID is normally used, but that won't interpolate
>>>> unless you explicitly tell it to.
>>>
>>> CONGRID interpolates 3-dimensional arrays by default. From the online
>>> help for the INTERP keyword for CONGRID:
>>>
>>> INTERP
>>> Set this keyword to force CONGRID to use linear interpolation when
>>> resizing a 1- or 2-dimensional array. CONGRID automatically uses
>>> linear interpolation if the input array is 3-dimensional. When the
>>> input array is 1- or 2-dimensional, the default is to employ nearest-
>>> neighbor sampling.
>>
>> How is "nearest neighbor sampling" not interpolation? Does it
>> explicitly avoid knowledge of how the new array cell is positioned
>> w.r.t. the old one, and simply grab averages of nearby neighbors? ...
>
> No. It grabs the value of the one nearest neighbor, with appropriate
> rules for breaking ties. No averaging of any kind is done on that
> value, which is why it's inappropriate to call this 'interpolation'.

Right, David corrected me. I guess my brain was registering "nearest
neighbor interpolation" with some weighted averaging.

>> ... Why
>> would this ever be preferable to a linear interpolation?
>
> Well, for one thing, it's a lot faster.
>
> However, another good reason is if you're re-binning categorical
> data, where the codes representing each category are arbitrary, and
> it's simply not meaningful to take the average of the category codes.
> If category 1 means 'corn' and category 3 means 'wheat', you don't
> want a thin barrier line of category 2 (meaning 'barley') to ocurr at
> the boundaries between wheat fields and corn fields. when you rebin
> your data. Nearest neighbor interpolation will always generate either
> 1 or 3 along that boundary.

Good example.

Thanks,

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Pasting subarray into array with compound assignment
Next Topic: Re: newbie's question for writing files

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

Current Time: Fri Oct 10 01:00:58 PDT 2025

Total time taken to generate the page: 0.71969 seconds