# Interpolating 2D data on a hemisphere in order to have $C^2$ function but no overshoot

I am interpolating a 2D dataset on a hemisphere, and I am currently using scipy.Rbf that I like for its simplicity.

I am defining the norm of the interpolator with the haversine formula in order to respect the fact that I am on a hemisphere, and doing a cubic interpolation in order to have a $$C^2$$ function at the end, but the problem is that I also want to avoid overshoot, meaning that no interpolated point can be higher than the maximum known value or lower than the minimum known value (more precisely, it can be lower than the minimum known value but always greater than zero, but the first requirement would be enough).

The best solution would be to have directly a function that I can give to scipy.Rbf that can handle these conditions, but if it's not possible, I may try a different algorithm.

• What do you mean for overshoot? Commented Dec 23, 2022 at 14:48
• No interpolated value can be higher than the maximum known value or lower than the minimum known value. Commented Jan 2, 2023 at 13:14
• It sounds as if you don't need an interpolator but an approximating function, am I understanding it right? Commented Jan 2, 2023 at 21:29
• Not exactly. Let's say that I have a set of points $\{\{0, 0\}, \{\pi/4, 0\}, \{\pi/4, \pi/2\}, \{\pi/4, \pi\}, \{\pi/4, 3\pi/2\}, ...\}$ where the first value in each duet is the $\theta$ coordinate and the second is the $\phi$ coordinate, and for each point I know its value $\{5000, 2000, ...\}$. I may now want to know what will be the values for new points $\{\{\pi/4, \pi/3\}, ...\}$. I want to do an interpolation on these points, that will always give me positive values less than the maximum known value, and that will create a set of points that is $C^2$. Commented Jan 3, 2023 at 12:51

You may have a look at Monoton Preserving Cubic $$C^1$$ or Quintic Hermite $$C^2$$ interpolants, here. A 1D version is available via pchip method in Matlab, here. See also the 2D makima variant here (not fully monoton). An extension to sphere surfaces may require some effort, however still feasible.
• Hermite interpolants are not $C^1$ for 2-manifolds, in general. They might have continuous partial derivatives, that is a necessary but not sufficient condition. Commented Jan 3, 2023 at 20:48