I am trying to interpolate a 2d array using scipy.RectBivariateSpline.
The original grid and the grid used to interpolate are the same. I do this is to interpolate the empty value of the original data. But the result turns out to be all nan.
And my code is:
interp_spline = RectBivariateSpline(xi_1,yi_1,u)
Ui = interp_spline(xi_2,yi_2)
Here are the input parameters:
xi_1 = [48.5, 80.5, 112.5, 144.5, 176.5, 208.5, 240.5, 272.5, 304.5, 336.5, 368.5, 400.5, 432.5, 464.5, 496.5, 528.5, 560.5, 592.5, 624.5, 656.5, 688.5, 720.5, 752.5, 784.5, 816.5, 848.5, 880.5, 912.5, 944.5, 976.5, 1008.5, 1040.5, 1072.5, 1104.5, 1136.5, 1168.5, 1200.5, 1232.5, 1264.5, 1296.5, 1328.5, 1360.5, 1392.5, 1424.5, 1456.5, 1488.5, 1520.5, 1552.5, 1584.5, 1616.5, 1648.5, 1680.5, 1712.5, 1744.5, 1776.5, 1808.5, 1840.5, 1872.5]
yi_1 = [48.5, 80.5, 112.5, 144.5, 176.5, 208.5, 240.5, 272.5, 304.5, 336.5, 368.5, 400.5, 432.5, 464.5, 496.5, 528.5, 560.5, 592.5, 624.5, 656.5, 688.5, 720.5, 752.5, 784.5, 816.5, 848.5, 880.5, 912.5, 944.5, 976.5, 1008.5, 1040.5, 1072.5, 1104.5, 1136.5]
xi_2 = [48.5, 80.5, 112.5, 144.5, 176.5, 208.5, 240.5, 272.5, 304.5, 336.5, 368.5, 400.5, 432.5, 464.5, 496.5, 528.5, 560.5, 592.5, 624.5, 656.5, 688.5, 720.5, 752.5, 784.5, 816.5, 848.5, 880.5, 912.5, 944.5, 976.5, 1008.5, 1040.5, 1072.5, 1104.5, 1136.5, 1168.5, 1200.5, 1232.5, 1264.5, 1296.5, 1328.5, 1360.5, 1392.5, 1424.5, 1456.5, 1488.5, 1520.5, 1552.5, 1584.5, 1616.5, 1648.5, 1680.5, 1712.5, 1744.5, 1776.5, 1808.5, 1840.5, 1872.5]
yi_2 = [48.5, 80.5, 112.5, 144.5, 176.5, 208.5, 240.5, 272.5, 304.5, 336.5, 368.5, 400.5, 432.5, 464.5, 496.5, 528.5, 560.5, 592.5, 624.5, 656.5, 688.5, 720.5, 752.5, 784.5, 816.5, 848.5, 880.5, 912.5, 944.5, 976.5, 1008.5, 1040.5, 1072.5, 1104.5, 1136.5]
xi_1 is equal to xi_2
yi_1 is equal to yi_2
u = [Input 2d array, has empty value in the right-down corner.] (link: https://i.stack.imgur.com/CkayC.png)
The result turns out to be all nan:
Ui = [[nan nan nan ... nan nan nan]
[nan nan nan ... nan nan nan]
[nan nan nan ... nan nan nan]
...
[nan nan nan ... nan nan nan]
[nan nan nan ... nan nan nan]
[nan nan nan ... nan nan nan]]
Does anyone know how to fix it? I have found some said that if there's nan in the last corner of the array, it will become all nan. But the problem seems to be unsolved.