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

Home » Public Forums » archive » Re: Mean preserving interpolation (conservative interpolation)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Mean preserving interpolation (conservative interpolation) [message #81795] Wed, 17 October 2012 02:35
Brigitte is currently offline  Brigitte
Messages: 2
Registered: October 2012
Junior Member
Thank you both for the answer.
frebin does a good job!
Cheers,
Brigitte
Re: Mean preserving interpolation (conservative interpolation) [message #81798 is a reply to message #81795] Tue, 16 October 2012 10:14 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
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
Re: Mean preserving interpolation (conservative interpolation) [message #81799 is a reply to message #81798] Tue, 16 October 2012 09:52 Go to previous message
DavidF[1] is currently offline  DavidF[1]
Messages: 94
Registered: April 2012
Member
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?

The keyword you are looking for is MINUS_ONE:

IDL> x = (Findgen(100)+1)*4
IDL> print, Mean(x)
202.000
IDL> print, mean(congrid(x, 200, /minus_one))
202.000
IDL> print, mean(congrid(x, 5250, /minus_one))
202.000
IDL> print, mean(congrid(x, 5250, /interp, /minus_one))
202.000
IDL> print, mean(congrid(x, 367, /interp, /minus_one))
202.000


Cheers,

David
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Axis equal
Next Topic: Re: Axis equal

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

Current Time: Wed Oct 08 15:52:08 PDT 2025

Total time taken to generate the page: 0.00575 seconds