When I interpolate y=congrid(x,ny,/interp) an array, the mean of the original array (x) is different from the mean of the interpolated array (y). Is there a function or keyword to preserve the mean?
I am new to this user group - hope the question is understandable and there is an answer! Thanks a lot in advance.
Brigitte writes:
> When I interpolate y=congrid(x,ny,/interp) an array, the mean of the original array (x) is different from the mean of the interpolated array (y). Is there a function or keyword to preserve the mean?
On Tuesday, October 16, 2012 12:52:39 PM UTC-4, Coyote wrote:
> The keyword you are looking for is MINUS_ONE:
While the /MINUS_ONE keyword works for your particular example, I don't believe it is a general solution. I'd suggest frebin.pro ( http://idlastro.gsfc.nasa.gov/ftp/pro/image/frebin.pro ) as a flux-conserving alternative to CONGRID.
IDL> x = randomn(seed,100)*10
IDL> y = congrid(x,367,/minus_one,/interp)
IDL> z = frebin(x,367) IDL> print,mean(x),mean(y),mean(z)
-0.593289 -0.546786 -0.593280