Search code examples
pythonscipyinterpolationextrapolation

How to perform extrapolation in 2D with scipy.interpolate.RBFInterpolator?


This wonderful SO answer by @AndrasDeak claims that 2D scipy.interpolate.RBFInterpolator can extrapolate, but it doesn't say how. Since I know that SciPy has unique extrapolation commands for each of its interpolators, I have been looking for the way extrapolation is embedded into 2D scipy.interpolate.RBFInterpolator and failed to find one. The only thing I could find is this "tips and tricks" article which suggests a complicated do-it-yourself extrapolation technique. I can't believe I'm stuck with this scary do-it-yourself thing because the referenced SO post explicitly states that RBFInterpolator can extrapolate.

With that in mind, is there a simple way to make 2D RBFInterpolator extrapolate the data (like for example, in the case of Akima1DInterpolator we set the argument "extrapolate" to True or in the case of interp1d we set the argument "fill_value" to extrapolate)?


Solution

  • With that in mind, is there a simple way to make 2D RBFInterpolator extrapolate the data?

    There's a very simple way. :) If you call RBFInterpolator normally, it will allow you to extrapolate outside of the points you've given it.

    RBFInterpolator doesn't make a distinction between interpolation and extrapolation. With a method like griddata(), there is a clear line (or a clear hyperplane, har har) between what is interpolation and what is extrapolation. With RBF the distinction is not meaningful.