I have a numpy masked matrix. And wanted to do interpolation in the masked regions. I tried the RectBivariateSpline but it didn't recognize the masked regions as masked and used those points also to interpolate. I also tried the bisplrep after creating the X,Y,Z 1d vectors. They were each of length 45900. It took a lot of time to calculate the Bsplines. And finally gave a Segmentation fault while running bisplev . The 2d matrix is of the size 270x170.
Is there any way to make RectBivariateSpline not to include the masked regions in interpolation? Or is there any other method? bisplrep was too slow.
Thanking you, indiajoe
ACTUALIZACIÓN: When the grid is small the scipy.interpolate.Rbf with 'linear' function is doing reasonable job. But it gives error when the array is large.
Is there any other function which will allow me to interpolate and smooth my matrix?
I have also concluded the following. Do correct me if I am wrong.
1) RectBivariateSpline requires perfect filled matrix and hence masked matrices cannot be used.
preguntado el 10 de marzo de 12 a las 07:03
Very late, but...
I have a problem similar to yours, and am getting the segmentation fault with bisplines, and also memory error with rbf (in which the "thin_plate" function works great for me.
Since my data is unstructured but is created in a structured manner, I use downsampling to half or one third of the density of data points, so that I can use Rbf. What I advise you to do is (very inefficient, but still better than not doing at all) to subdivide the matrix in many overlapping regions, then create rbf interpolators for each region, then when you interpolate one point you choose the appropriate interpolator.
Also, if you have a masked array, you could still perform interpolation in the unmasked array, then apply the mask on the result. (well actually no, see the comments)
Espero que esto ayude a alguien