Make Scatter Interpolation behave like Linear Interpolation?

Hi all!
I have a very interesting Data set to interpolate and I need a bit of help.
I have 5D knots and a Value that I need interpolated. The Columns are (just for you to know)

Temperature Pressure Mineral_%1 Mineral%2 Mineral%_3 Wave_Speed

Now, the interesting thing is that the sum of Mineral_%_N is always 100 %, so you can imagine that the knots of my interpolation are kind of weird. If i initialise some matrix to fill an the interpolate it would look like this:


t=sort(unique(Temperature));
pr=sort(unique(Pressure));
q=sort(unique(Qz));
a=sort(unique(A));
pl=sort(unique(P));

Felsic_Vp_M=zeros(size(t,1),size(pr,1),size(q,1),size(a,1),size(pl,1));
Felsic_Vs_M=zeros(size(t,1),size(pr,1),size(q,1),size(a,1),size(pl,1));
Felsic_Rho_M=zeros(size(t,1),size(pr,1),size(q,1),size(a,1),size(pl,1));

Now, using Interpolations.jl this gives me the problem that there are too many zeros in my data and creates minima where I do not have data when I do:

Felsic_Vp = interpolate((t,pr,q,a,pl), Felsic_Vp_M, Gridded(Linear()));
Felsic_Vs = interpolate((t,pr,q,a,pl), Felsic_Vs_M, Gridded(Linear()));
Felsic_Rho = interpolate((t,pr,q,a,pl), Felsic_Rho_M, Gridded(Linear()));

I have also tried ScatteredInterpolations.jl with:

samples_Vp=DATA_MAFIC[:,6];
samples_Vs=DATA_MAFIC[:,7];
samples_Rho=DATA_MAFIC[:,8];
points=DATA_MAFIC[:,1:5]';
Mafic_Vp = interpolate(Polyharmonic(), points, samples_Vp);
Mafic_Vp = interpolate(MultiQuadratic(), points, samples_Vp);

This is better, but the interpolations creates local minima between nodes that is greatly affecting my computations later on.

So. My question. My data needs to be Linearly interpolated (I know this from a lot of testing). Any idea if I can make any of the methods in ScatteredInterpolation.jl behave like linear interpolations? Or, Maybe there is a way to use Interpolations.jl with this data set in a way I do not know

THANKS!!!

I think with three “coordinates” being always related by their sum being 100 it would be more natural to work with only two of them as input (independent coordinates) for your interpolation. This will probably greatly help with interpolations since now data coverage is in a 4D domain instead of a 5D domain.
As you have observational data, it might be also better to use smoothing interpolations (with more or almost no smoothing if you want to) and you might try DIVAnd with does exactly that; (smoothed) interpolations in N Dimensions

(Edit: if your three percentages are taken as fractions f1, f2, f3 with f1+f2+f3=1, a nice coordinate system to use could be

x= f1+f2
y=f2/(f1+f2)

and they inverse relationship f1=(1-x)y ; f2=x y; f3=1-f2-f3

That would you allow to work on a square domain [0, 1]x[0, 1] for the coordinates x, y
)

2 Likes

Hi @JM_Beckers
This is a nice idea. I will check DIVAnd, I hope it can create a julia interpolation function like the other packages.
I will report back!