| Re: Adding elements in an Array [message #85991 is a reply to message #85988] |
Mon, 23 September 2013 13:48   |
Mats Löfdahl
Messages: 263 Registered: January 2012
|
Senior Member |
|
|
On 2013-09-23 22:36, David Fanning wrote:
> David Fanning writes:
>
>>
>> wlandsman writes:
>>
>>> "Normally, REBIN uses bilinear interpolation when magnifying and neighborhood averaging when minifying."
>>
>> I suppose it would take me a couple of days scratching my head to figure
>> this out!
>>
>> Do you know this to be true, or are you just taking their word for it?
>> I'm not sure "neighborhood averaging" means what you appear to think it
>> means. If you are right, it certainly doesn't mean what I think it
>> means! And, in any case, I wouldn't bet the satellite on it until I ran
>> a couple of tests. :-)
>
> I guess you are right. Wow! I learn something every day about IDL!
>
> IDL> a = [10, 20, 5, 6, 18, 17, 1, 30, 2]
> IDL> print, rebin(a, 3)
> 11 13 11
> IDL> print, rebin(a, 3, /sample)
> 10 6 1
11 and 13 are not the mean values of [10, 20, 5] and [6, 18, 17],
respectively. 11 happens to be the mean of [1, 30, 2] but in general you
need floating point calculations:
IDL> print,rebin(float(a),3)
11.6667 13.6667 11.0000
|
|
|
|