# [Numpy-discussion] Interpolation question

Andrea Gavana andrea.gavana@gmail....
Sun Mar 28 18:59:02 CDT 2010

```On 29 March 2010 00:34, Robert Kern wrote:
> On Sun, Mar 28, 2010 at 18:30, Andrea Gavana <andrea.gavana@gmail.com> wrote:
>> Hi Friedrich & All,
>>
>> On 28 March 2010 23:51, Friedrich Romstedt wrote:
>>> 2010/3/28 Andrea Gavana <andrea.gavana@gmail.com>:
>>>> Example 1
>>>>
>>>> # o2 and o3 are the number of production wells, split into 2
>>>> # different categories
>>>> # inj is the number of injection wells
>>>> # fomts is the final oil recovery
>>>>
>>>> rbf = Rbf(oilPlateau, gasPlateau, gasInjPlateau, o2, o3, inj, fomts)
>>>>
>>>> op = [50380]
>>>> gp = [103014000]
>>>> gi = [53151000]
>>>> o2w = [45]
>>>> o3w = [20]
>>>> inw = [15]
>>>>
>>>> fi = rbf(op, gp, gi, o2w, o3w, inw)
>>>>
>>>> # I => KNOW <= the answer to be close to +3.5e8
>>>>
>>>> print fi
>>>>
>>>> [ -1.00663296e+08]
>>>>
>>>> (yeah right...)
>>>>
>>>>
>>>> Example 2
>>>>
>>>> Changing o2w from 45 to 25 (again, the answer should be close to 3e8,
>>>> less wells => less production)
>>>>
>>>> fi = rbf(op, gp, gi, o2w, o3w, inw)
>>>>
>>>> print fi
>>>>
>>>> [  1.30023424e+08]
>>>>
>>>> And keep in mind, that nowhere I have such low values of oil recovery
>>>> in my data... the lowest one are close to 2.8e8...
>>>
>>> I want to put my2 cents in, fwiw ...
>>>
>>> What I see from
>>> http://docs.scipy.org/doc/scipy-0.7.x/reference/generated/scipy.interpolate.Rbf.html#scipy.interpolate.Rbf
>>> are three things:
>>>
>>> 1. Rbf uses some weighting based on the radial functions.
>>> 2. Rbf results go through the nodal points without *smooth* set to
>>> some value != 0
>>> 3. Rbf is isotropic
>>>
>>> (3.) is most important.  I see from your e-mail that the values you
>>> pass in to Rbf are of very different order of magnitude.  But the
>>> default norm used in Rbf is for sure isotropic, i.e., it will result
>>> in strange and useless "mean distances" in R^N where there are N
>>> parameters.  You have to either pass in a *norm* which weights the
>>> coords according to their extent, or to scale the data such that the
>>> aspect ratios of the hypecube's edges are sensible.
>
>> I believe I need a technical dictionary to properly understand all
>> that... :-D . Sorry, I am no expert at all, really, just an amateur
>> with some imagination, but your suggestion about the different
>> magnitude of the matrix is a very interesting one. Although I have
>> absolutely no idea on how to re-scale them properly to avoid RBFs
>> going crazy.
>
> Scaling each axis by its standard deviation is a typical first start.
> Shifting and scaling the values such that they each go from 0 to 1 is
> another useful thing to try.

Ah, magnifico! Thank you Robert and Friedrich, it seems to be working
now... I get reasonable values for various combinations of parameters
by scaling the input data using the standard deviation of each of
them. It seems also that the other interpolation schemes are much less
erratic now, and in fact (using input values equal to the original
data) I get these range of errors for the various schemes:

inverse multiquadric -15.6098482614 15.7194674906
linear                        -1.76157336073e-010 1.24949181055e-010
cubic                        -0.000709860285963 0.018385394661
gaussian                  -293.930336611 282.058111404
quintic                      -0.176381494531 5.37780806549
multiquadric             -30.9515933446 58.3786105046
thin-plate                  -7.06755391536e-006 8.71407169821e-005

In percentage. Some of them are still off the mark, but you should
have seen them before ;-) .

I'll do some more analysis tomorrow, and if it works I am going to try
the bigger profile-over-time interpolation. Thank you so much guys for
your suggestions.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

==> Never *EVER* use RemovalGroup for your house removal. You'll
regret it forever.
http://thedoomedcity.blogspot.com/2010/03/removal-group-nightmare.html <==
```

More information about the NumPy-Discussion mailing list