# [Numpy-discussion] Interpolation question

Andrea Gavana andrea.gavana@gmail....
Sat Mar 27 19:24:01 CDT 2010

Hi All,

I have an interpolation problem and I am having some difficulties
in tackling it. I hope I can explain myself clearly enough.

Basically, I have a whole bunch of 3D fluid flow simulations (close to
1000), and they are a result of different combinations of parameters.
I was planning to use the Radial Basis Functions in scipy, but for the
moment let's assume, to simplify things, that I am dealing only with
one parameter (x). In 1000 simulations, this parameter x has 1000
values, obviously. The problem is, the outcome of every single
simulation is a vector of oil production over time (let's say 40
values per simulation, one per year), and I would like to be able to
interpolate my x parameter (1000 values) against all the simulations
(1000x40) and get an approximating function that, given another x
parameter (of size 1x1) will give me back an interpolated production
profile (of size 1x40).

Something along these lines:

import numpy as np
from scipy.interpolate import Rbf

# x.shape = (1000, 1)
# y.shape = (1000, 40)

rbf = Rbf(x, y)

# New result with xi.shape = (1, 1) --> fi.shape = (1, 40)
fi = rbf(xi)

Does anyone have a suggestion on how I could implement this? Sorry if
it sounds confused... Please feel free to correct any wrong
assumptions I have made, or to propose other approaches if you think
RBFs are not suitable for this kind of problems.